added documentation for using cookies feature via CLI to the README
This commit is contained in:
parent
31b8f4a179
commit
a0823ea36f
12
README.md
12
README.md
|
@ -214,6 +214,7 @@ Using the CLI:
|
|||
```
|
||||
youtube_transcript_api <first_video_id> <second_video_id> --http-proxy http://user:pass@domain:port --https-proxy https://user:pass@domain:port
|
||||
```
|
||||
|
||||
## Cookies
|
||||
|
||||
Some videos are age restricted, so this module won't be able to access those videos without some sort of authentication. To do this, you will need to have access to the desired video in a browser. Then, you will need to download that pages cookies into a text file. You can use the Chrome extension [cookies.txt](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg?hl=en) or the Firefox extension [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/).
|
||||
|
@ -223,11 +224,18 @@ Once you have that, you can use it with the module to access age-restricted vide
|
|||
```python
|
||||
from youtube_transcript_api import YouTubeTranscriptApi
|
||||
|
||||
YouTubeTranscriptApi.get_transcript(video_id, cookies=<string of path to your cookies text file>)
|
||||
YouTubeTranscriptApi.get_transcript(video_id, cookies='/path/to/your/cookies.txt')
|
||||
|
||||
YouTubeTranscriptApi.get_transcripts([video_id], cookies=<string of path to your cookies text file>)
|
||||
YouTubeTranscriptApi.get_transcripts([video_id], cookies='/path/to/your/cookies.txt')
|
||||
```
|
||||
|
||||
Using the CLI:
|
||||
|
||||
```
|
||||
youtube_transcript_api <first_video_id> <second_video_id> --cookies /path/to/your/cookies.txt
|
||||
```
|
||||
|
||||
|
||||
## Warning
|
||||
|
||||
This code uses an undocumented part of the YouTube API, which is called by the YouTube web-client. So there is no guarantee that it won't stop working tomorrow, if they change how things work. I will however do my best to make things working again as soon as possible if that happens. So if it stops working, let me know!
|
||||
|
|
Loading…
Reference in New Issue