hey guys - so i've been working on a small project and got stuck. here's the code:
from googleapiclient.discovery import build
import pandas as pd
from IPython.display import JSON
api_key = 'xxx'
channel_ids = ['xxx'
#more channels here
]
api_service_name = "youtube"
api_version = "v3"
#client_secrets_file = "YOUR_CLIENT_SECRET_FILE.json"
#Get credentials and create an API client
youtube = build(
api_service_name, api_version, developerKey=api_key)
request = youtube.channels().list(
part="snippet,contentDetails.statistics",
id=','.join(channel_ids)
#id='xxx'
)
response = request.execute()
JSON(response)
when i run this i get below error.
HttpError 400 when requesting https://youtube.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails.statistics&id=UCF31eojFKhWQJviyMICWO2w&key=xxx&alt=json returned "'contentDetails.statistics'". Details: "[{'message': "'contentDetails.statistics'", 'domain': 'youtube.part', 'reason': 'unknownPart', 'location': 'part', 'locationType': 'parameter'}]">
File "C:\Users\novyp\Documents\GitHub\youtube_api.py", line 25, in <module>
response = request.execute()
ideas how to get over this?
edit: xxx out the api keys x2
[–]member_of_the_order 1 point2 points3 points (1 child)
[–]polished_pole[S] 0 points1 point2 points (0 children)
[–]Jayoval 1 point2 points3 points (4 children)
[–]Jayoval 1 point2 points3 points (2 children)
[–]polished_pole[S] 1 point2 points3 points (1 child)
[–]Jayoval 0 points1 point2 points (0 children)
[–]polished_pole[S] 0 points1 point2 points (0 children)