I am trying to create a Python program to get channel statisitics, but when I run it the YouTube API website gives this output (error):
{ "error": { "code": 400, "message": "'statisitcs'", "errors": [ { "message": "'statisitcs'", "domain": "youtube.part", "reason": "unknownPart", "location": "part", "locationType": "parameter" } ] } }
This is my code:
class YTstats: def __init__(self, api_key, channel_id): self.api_key = api_key self.channel_id = channel_id self.channel_stats = None def get_channel_statistics(self): url = f'https://www.googleapis.com/youtube/v3/channels?part=statisitcs&id={self.channel_id}&key={self.api_key}' print(url) API_KEY = 'I cannot share my api key so I am not showing it but it is in my code' yt = YTstats(API_KEY, 'UCbXgNpp0jedKWcQiULLbDTA') yt.get_channel_statistics()
Advertisement
Answer
This problem is fixed now (it was a typo)