It would be very useful (for me, anyways) to be able to check if a video has been blocked in my country before I attempt to download it. I feel a simple method added to the Video class that would return a boolean would do the trick.
I hope you'd be able to do this with relative ease 馃憤
Apparently, it should be available on watch page:
https://github.com/rg3/youtube-dl/blob/870f3bfc635586ba76a242f1a2f3fbac2c99bad5/youtube_dl/extractor/youtube.py#L1608
Any news on this? It's been a good long while.
Didn't prioritize it yet, mostly because I struggle to find the use case, considering you can always try/catch.
Also, in case you're wondering, #155 does not have regionsAllowed anywhere.
Well, my use case has changed in these few months, but basically I'd like to have a way check specifically if a video is country blocked so I could grab the data from the YouTube API instead. The main reason I'd want to do this is because there's currently no way to get information about a video with YoutubeExplode if a video is unavailable; all that is given is an exception.
I suppose this could go in a different issue, but that's all I really want; as much info as possible even if the video is unavailable as well as some sort of way to determine why it's unavailable if YouTube provides it for that video.
Perhaps a solution that is more elegant than #154 with nullable types and such would be the best way to go.
Edit: Also, about #155, how are websites such as this one or this one able to get region block information if there is no regionsAllowed for them to use?
What kind of information do you need? There are certain things that can be obtained even if the video is unavailable.
Regarding edit: good question. Perhaps they're using a different method.
The main bits of information I need are the name of the video and the name of the channel that uploaded the video. Duration and any res thumbnail would be nice to have as well, though I can just put in placeholders if neither are available.
Another somewhat important bit of information would be the reason as to why it's unavailable (if YouTube provides one). For me, I'd like to have that so I can decide how I want to go about processing it. For example, if it's country blocked, I'd like to pass the whole thing off to another node in a different country where it's not blocked. Or, if it's a private video, I'd like to stop trying
to process it and display a message to the user. Just an enum in VideoUnavailableException would suffice.
If you're not able to reliably implement that, then I suppose I'll just have to trial and error it and try to figure it out programmatically. Though, the first two bits of info are the more important ones so I don't have to go looking on the YouTube API.
The title and thumbs can be scraped from oembed, not sure about channel name.
YouTube generally doesn't provide much information, but what it does provide is shown in the exception already.
Alrighty then, whatever you can implement then would be great to have.
Here's an example of data, is this enough?
https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json
It doesn't provide anything similar for playlist it seems.
Closed in favor of #163
Looks like that'd be good enough :)
Thank you! I look forward to when #163 is implemented.