'YouTube Data API badRequest: Invalid Argument. Could not get correct channel data

I am quite new in programming so sorry if the question is silly:

I tried to download statistics from my YouTube account (video views, likes, etc.) via YouTube Data API + Python 3.10. (I'm using PyCharm). I followed this tutorial :https://www.youtube.com/watch?v=5qtC-tsQ-wE (you can see the code here: https://github.com/python-engineer/youtube-analyzer)

BUT

I end up getting this error:

get channel statistics...
100%|██████████| 1/1 [00:00<00:00,  8.00it/s]
Could not get channel statistics
get video data...
Error! Could not get correct channel data!
 {'error': {'code': 400, 'message': 'Request contains an invalid argument.', 'errors': [{'message': 'Request contains an invalid argument.', 'domain': 'global', 'reason': 'badRequest'}], 'status': 'INVALID_ARGUMENT'}}
data is missing!
Call get_channel_statistics() and get_channel_video_data() first!
0it [00:00, ?it/s]
Process finished with exit code 0

Does someone know how I can fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source