added documentation for using cookies feature via CLI to the README

This commit is contained in:
Jonas Depoix 2020-01-31 11:26:39 +01:00
parent 31b8f4a179
commit a0823ea36f
1 changed files with 12 additions and 4 deletions

View File

@ -213,7 +213,8 @@ 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,10 +224,17 @@ 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