google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

API Call 'youtube#searchListResponse' return inconsistent results

Open dudio92 opened this issue 1 year ago • 1 comments

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-client version: 2.138.0

Steps to reproduce

  1. 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()
  1. Observe results count
  2. Run step 1 again
  3. 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!

dudio92 avatar Jul 29 '24 09:07 dudio92

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!

vchudnov-g avatar Sep 23 '24 19:09 vchudnov-g

As per the previous comment, we recommend to file an issue directly with the API team. Closing this issue.

ohmayr avatar Mar 04 '25 19:03 ohmayr