For the last few days I've been playing around with the YouTube data API v3 and for some reason, every time I run the code Google provides here. Copying the code, pasting in to my own IDE and fixing all the Python 2 to Python 3 errors (for some reason Google still hasn't updated their guide), creating a client_secrets.json file with all the correct information, and also replacing the apiclient module with googleapiclient. I run the script with the args that Google provides:
python upload_video.py --file="/tmp/test_video_file.flv" --title="Summer vacation in California" --description="Had fun surfing in Santa Cruz" --keywords="surfing,Santa Cruz" --category="22" --privacyStatus="private"all in one line of course, but when I do, I of course get greeted with an authentication screen from my browser (I use Chrome). After logging in and accepting the application, I return to my terminal and see this line: Authentication has failed: Invalid response: 400.. This appears at the bottom of the output and is the last thing that prints to the screen before closing the program. I've tried fixing it by watching a lot of tutorials and reading pretty much the whole Google guide on the API, I also read this page and altered my code from here until I got this:
flow = InstalledAppFlow.from_client_secrets_file("client_secrets.json", scopes=["openid", "https://www.googleapis.com/auth/youtube.upload"])credentials = flow.run_local_server()service = build('calendar', 'v3', credentials=credentials)but this code results in another error, before even being able to get to the API, saying that the token can't be accessed (from flow.run_local_server()). I am really lost with this and have no idea how to fix it. If anyone knows the details on the Google OAuth system, please let me know.
I've tried everything. I even used a different machine, made a whole new Google app for this and read the (basically) non-existent documentation... I'd expect a massive corporation like Google to have a very clear and concise guide on stuff like this