Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
How to download YouTube captions via API

I've been trying to work out how to download YouTube captions via the API but the official instructions are tailored towards command line code whereas I'm trying to do this in Python Shell.

Currently I've been following this page to no avail - [https://developers.google.com/youtube/v3/docs/captions/list](https://developers.google.com/youtube/v3/docs/captions/list)

What seems to trip me up is the Storage and args pieces of code which even after much googling doesn't make any sense to me.

See below:

storage = Storage("%s-oauth2.json" % sys.argv[0])
#nowhere on the page does it refer to this oauth2.json file 
credentials = storage.get()
if credentials is None or credentials.invalid:   
credentials = run_flow(flow, storage, args)
#if credentials is none why would storage still be needed as an argument?

In the second half of the page, it's all adding arguments to args which I assume is command line stuff that I don't want to use as I'm working from Python Shell.

​

I've also been reading the official page on getting authorization OAuth 2.0 so I can rewrite this code myself but I can't get past this part: [https://developers.google.com/api-client-library/python/auth/web-app](https://developers.google.com/api-client-library/python/auth/web-app)

## *Step 5: Exchange

/r/Python
https://redd.it/9jvm8k