cleanup
This commit is contained in:
parent
3d47c80446
commit
49f613ddeb
15 changed files with 98 additions and 234 deletions
|
@ -14,12 +14,12 @@ type QwantAPIResponse struct {
|
|||
Data struct {
|
||||
Result struct {
|
||||
Items []struct {
|
||||
Media string `json:"media"`
|
||||
Thumbnail string `json:"thumbnail"`
|
||||
Title string `json:"title"`
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Media string `json:"media"`
|
||||
//Thumbnail string `json:"thumbnail"`
|
||||
Title string `json:"title"`
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
} `json:"items"`
|
||||
} `json:"result"`
|
||||
} `json:"data"`
|
||||
|
@ -125,7 +125,7 @@ func PerformQwantImageSearch(query, safe, lang string, page int) ([]ImageSearchR
|
|||
return nil, 0, err
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", ImageUserAgent)
|
||||
req.Header.Set("User-Agent", ImageUserAgent) // Quant seems to not like some specific User-Agent strings
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
@ -148,22 +148,23 @@ func PerformQwantImageSearch(query, safe, lang string, page int) ([]ImageSearchR
|
|||
for i, item := range apiResp.Data.Result.Items {
|
||||
wg.Add(1)
|
||||
go func(i int, item struct {
|
||||
Media string `json:"media"`
|
||||
Thumbnail string `json:"thumbnail"`
|
||||
Title string `json:"title"`
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Media string `json:"media"`
|
||||
//Thumbnail string `json:"thumbnail"`
|
||||
Title string `json:"title"`
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}) {
|
||||
defer wg.Done()
|
||||
|
||||
// Populate the result
|
||||
results[i] = ImageSearchResult{
|
||||
Thumbnail: item.Thumbnail,
|
||||
Thumb: item.Media, // item.Thumbnail is not working
|
||||
Title: item.Title,
|
||||
Media: item.Media,
|
||||
Full: item.Media,
|
||||
Source: item.Url,
|
||||
ThumbProxy: "/imgproxy?url=" + item.Media,
|
||||
ProxyFull: "/imgproxy?url=" + item.Media,
|
||||
ProxyThumb: "/imgproxy?url=" + item.Media,
|
||||
Width: item.Width,
|
||||
Height: item.Height,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue