Skip to content

[Image Search API] It could not return plenty of results from multiple requests. #118

@wushaobo

Description

@wushaobo

API Name (Kind)

Image Search API: https://api.cognitive.microsoft.com/bing/v7.0/images/search

Issue Description

When I call Image Search API to collect images with a search term, say "car", I get only about 1000 results in total from all requests. I know there is a limitation for at most 150 results in each response, so I call the API multiple times with incremental offset. I don't understand which params I missed and I failed to find it from the official filter/option params list. Any idea for help? Thanks so much.

Detail

The console log as below is from the script I wrote, which tries to collect 10000 image records with the search term "car". The offset comes from the nextOffset value in the API response. The request querying images from offset 1000 returns 87 records and the nextOffset is still 1000, which means the future request will be the same as the current. Thus my script comes to the exit. I tried several times even with other search terms but I never get a little more image records returned. Apparently, there must be much more images than a thousand for a general search term.

Searched 150 records from offset 0
Saved 121 new photos, now 121/10000
Searched 150 records from offset 173
Saved 142 new photos, now 263/10000
Searched 150 records from offset 345
Saved 149 new photos, now 412/10000
Searched 137 records from offset 537
Saved 137 new photos, now 549/10000
Searched 150 records from offset 719
Saved 138 new photos, now 687/10000
Searched 94 records from offset 892
Saved 93 new photos, now 780/10000
Searched 87 records from offset 1000
Saved 0 new photos, now 780/10000
Unable to collect more images. Done.

The query params in the request URL is like,

count=1000&freshness=month&imageType=photo&license=all&offset=0&q=car

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions