google-api-python-client
google-api-python-client copied to clipboard
API Call 'youtube#searchListResponse' return inconsistent results
Hi All, I'm having an issue querying 'searchListResponse' with the same argument each call
Environment details
- OS type and version: MacOS 14.5 (23F79)
- Python version: Python 3.10.11
- pip version: pip 21.3.1
google-api-python-clientversion: 2.138.0
Steps to reproduce
- Run search() list as follows:
search().list(
part="snippet",
q='my search query',
type="video",
pageToken=None,
order='date',
publishedAfter=earliest_date,
publishedBefore=latest_date,
maxResults=1
)
response = request.execute()
- Observe results count
- Run step 1 again
- Observe again
Code example
for i in range(10):
request = self.youtube.search().list(
part="snippet",
q=query,
type="video",
pageToken=None,
order='date',
publishedAfter=earliest_date,
publishedBefore=latest_date,
maxResults=1
)
response = request.execute()
print(response['pageInfo'])
{'totalResults': 57238, 'resultsPerPage': 1}
{'totalResults': 81, 'resultsPerPage': 0}
{'totalResults': 57238, 'resultsPerPage': 1}
{'totalResults': 57238, 'resultsPerPage': 1}
{'totalResults': 57570, 'resultsPerPage': 1}
{'totalResults': 52429, 'resultsPerPage': 1}
{'totalResults': 81, 'resultsPerPage': 0}
{'totalResults': 57356, 'resultsPerPage': 1}
{'totalResults': 81, 'resultsPerPage': 0}
{'totalResults': 57849, 'resultsPerPage': 1}
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Hi @dudio92 ! Thanks for reporting this. This does not look like a client library issue, but rather an issue with the YouTube service API. Could you report your issue with search.list to the service team as suggested in https://developers.google.com/youtube/v3/support? Thanks!
As per the previous comment, we recommend to file an issue directly with the API team. Closing this issue.