Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3718

I'm sure there is data, but the YouTube Analytics API returns an empty row

$
0
0

I copied the code that successfully returns the correct data.

This is my code.

import osimport google_auth_oauthlib.flowimport googleapiclient.discoveryimport googleapiclient.errorsscopes = ["https://www.googleapis.com/auth/youtube.readonly"]client_secrets_file = client_secret_xxxxxxx.googleusercontent.com.json"# Disable OAuthlib's HTTPS verification when running locally.os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"# Get credentials and create an API clientflow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(client_secrets_file, scopes)credentials = flow.run_console()youtube_analytics = googleapiclient.discovery.build('youtubeAnalytics', 'v2', credentials=credentials)def main():    request = youtube_analytics.reports().query(        startDate='2022-06-26',         endDate='2022-06-30',        ids='channel==MINE',        dimensions= 'day',         metrics= 'views',    )    response = request.execute()    print(response['rows'])if __name__ == "__main__":    main()

My channel has 5 views on 2022-06-28.

My YouTube Studio also can see the data.

I expected it will return

[['2022-06-26', 0], ['2022-06-27', 0], ['2022-06-28', 5], ['2022-06-29', 0], ['2022-06-30', 0]]

But it only returned

[]

I found a lot of people have the same problem

Is it possible that this is an issue with the API itself?


Viewing all articles
Browse latest Browse all 3718

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>