Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions pkg/providers/urlscan/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package urlscan

import (
"strings"
"fmt"
jsoniter "github.com/json-iterator/go"
)

var _BaseURL = "https://urlscan.io/"
Expand All @@ -25,12 +27,18 @@ type archivedPage struct {
}

func parseSort(sort []interface{}) string {
var sortParam []string
for _, t := range sort {
switch t.(type) {
case string:
sortParam = append(sortParam, t.(string))
}
}
return strings.Join(sortParam, ",")
var sortParam []string

for _, t := range sort {
switch v := t.(type) {
case string:
sortParam = append(sortParam, v)
case jsoniter.Number:
sortParam = append(sortParam, v.String())
default:
sortParam = append(sortParam, fmt.Sprint(v))
}
}

return strings.Join(sortParam, ",")
}