From dc9fc2ee9342649e09e311b3b87dfc70dace4833 Mon Sep 17 00:00:00 2001 From: danielcliu Date: Wed, 15 Jan 2020 22:48:26 -0800 Subject: [PATCH] Updated Readme to include how to use cookies with the module --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4516f6..b5b5d20 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,19 @@ Using the CLI: ``` youtube_transcript_api --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/). + +Once you have that, you can use it with the module to access age-restricted videos' captions like so. + +```python +from youtube_transcript_api import YouTubeTranscriptApi +YouTubeTranscriptApi.get_transcript(video_id, cookies=) + +YouTubeTranscriptApi.get_transcripts([video_id], cookies=) +``` ## Warning @@ -224,4 +236,4 @@ youtube_transcript_api --http-proxy http://us If this project makes you happy by reducing your development time, you can make me happy by treating me to a cup of coffee :) -[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BAENLEW8VUJ6G&source=url) \ No newline at end of file +[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BAENLEW8VUJ6G&source=url)