Closed solarslurpi closed 1 year ago
Hi @solarslurpi, the reason you cannot get the transcript using the api, but you can in the browser, is that the video is age-restricted. Since you are probably logged into YouTube in your browser this is no problem using a browser, but it is for the API. You can work around this by using cookies.
I know the error message is currently a bit misleading. There is a ticket to work on a more descriptive error message! 😊
Thank you @jdepoix. Mostly, thank you for your library. It is so very helpful! Also, I am grateful for your reply. You are right, a better error message would be great! A couple of things I do not understand:
Hi @solarslurpi, thank you very much for the kind words an the support!! 🥳
To be honest, I don't quite know how the age-restriction works, but I figured that it is automatically done by YouTube and not by the uploader. Since the videos seem to be about cannabis, I would imagine that some of them contain words which YouTube links to drug abuse or something like that, and therefore applies age-restriction to them. Regarding your section question: it definitely seems that you can't retrieve the subtitle for those because they are disabled, but I unfortunately cannot tell you why they are disabled and whether that's because of YouTube or because of the uploader choosing to not enable transcripts for those. I am sorry that I do not have more information here!
DO NOT DELETE THIS! Please take the time to fill this out properly. I am not able to help you if I do not know what you are executing and what error messages you are getting. If you are having problems with a specific video make sure to include the video id.
To Reproduce
What code / cli command are you executing?
For example: I am running
Which Python version are you using?
Python 3.10.11
Which version of youtube-transcript-api are you using?
youtube-transcript-api-0.6.1
Expected behavior
Describe what you expected to happen. transcript is downloaded. For example, this video_id works fine: MNlooDlfJns
I can't figure out the difference. The error indicates the html doesn't include "captions": and indeed it doesn't. I then made sure cc was checked. (which is weird if i want the transcript?) still no luck.
Actual behaviour
Describe what is happening instead of the Expected behavior. Add error messages if there are any.