mirror of
https://github.com/karust/openserp.git
synced 2026-09-08 20:46:23 +08:00
Google images scroll parsing
This commit is contained in:
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -18,6 +19,19 @@ type SearchResult struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
func ConvertSearchResultsMap(searchResultsMap map[string]SearchResult) *[]SearchResult {
|
||||
searchResults := []SearchResult{}
|
||||
|
||||
for _, v := range searchResultsMap {
|
||||
searchResults = append(searchResults, v)
|
||||
}
|
||||
|
||||
sort.Slice(searchResults, func(i, j int) bool {
|
||||
return searchResults[i].Rank < searchResults[j].Rank
|
||||
})
|
||||
return &searchResults
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
Text string
|
||||
LangCode string // eg. EN, ES, RU...
|
||||
|
||||
Reference in New Issue
Block a user