A feature-rich command-line audio/video downloader
[snagfilms:embed] Capture geolocation restriction error
Sergey M․9fbfc9bd4dd0
diff --git a/youtube_dl/extractor/snagfilms.py b/youtube_dl/extractor/snagfilms.pyindex f04ca60369..2b1838bf90 100644--- a/youtube_dl/extractor/snagfilms.py+++ b/youtube_dl/extractor/snagfilms.py@@ -4,6 +4,7 @@ import refrom .common import InfoExtractorfrom ..utils import (+ ExtractorError,clean_html,determine_ext,int_or_none,@@ -30,7 +31,8 @@ class SnagFilmsEmbedIE(InfoExtractor):@staticmethoddef _extract_url(webpage):mobj = re.search(- r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:embed\.)?snagfilms\.com/embed/player.+?)\1', webpage)+ r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:embed\.)?snagfilms\.com/embed/player.+?)\1',+ webpage)if mobj:return mobj.group('url')@@ -39,6 +41,10 @@ class SnagFilmsEmbedIE(InfoExtractor):webpage = self._download_webpage(url, video_id)+ if '>This film is not playable in your area.<' in webpage:+ raise ExtractorError(+ 'This film is not playable in your area.', expected=True)+formats = []for source in self._parse_json(js_to_json(self._search_regex(r'(?s)sources:\s*(\[.+?\]),', webpage, 'json')), video_id):