Geo restricted

YouTube will not play the video in this country.

The error#

GeoRestrictedError is a subclass of ExtractorError. The default message, used when the caller does not pass one, is:

This video is not available from your location due to geo restriction

For YouTube, the message that is passed through is the subreason, when it starts with:

The uploader has not made this video available in your country

raise_geo_restricted sets expected=True. If ignore_no_formats_error or wait_for_video is on and metadata is available, this becomes a warning instead of an exception.

What triggers it#

No formats were found, a subreason exists, and that subreason starts with the sentence above. Country codes are taken from availableCountries on the microformat, or from the regionsAllowed meta tag.

How to confirm#

The exception class is GeoRestrictedError, or the message starts with The uploader has not made this video available in your country. A generic unavailable video that does not start with that sentence stays on the no-formats path and is not this class.

Fixes#

The video's availability is chosen by the uploader and by YouTube's country list. A proxy exit in an allowed country is the change that matches the message. -t sleep and cookies do not add a country the uploader did not allow.

GeoRestrictedError stores the country list on .countries when the extractor found one.

SocialScrape#

Video details are GET /v1/youtube/video. Transcripts are GET /v1/youtube/video/transcript: the video's own captions. A video with no captions returns transcript_unavailable and costs nothing. AI transcription of YouTube audio is not available yet.

Failed requests cost 0 credits. New accounts get 100 credits on signup, no card.

Questions

What does SocialScrape return for a region lock?

unavailable_in_region, HTTP 451. It costs 0 credits.

Can I pass a country on the YouTube video endpoint?

Only if that endpoint's parameter list includes region. The video page says which parameters it accepts.