diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-11-24 22:52:04 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-11-24 22:52:04 +0100 |
commit | e8c8653e9d5091425f6c8b877d8a6c32a544a6bd (patch) | |
tree | 1a039f899a95f19e1b09248b8fb2d49c6d8cac35 /youtube_dl/extractor/francetv.py | |
parent | fab89c67c5e623a6b1a8e518b78a70fc39d5a006 (diff) | |
parent | 2c25a2bd29236ef744e3b9032230dc74c1029df5 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'youtube_dl/extractor/francetv.py')
-rw-r--r-- | youtube_dl/extractor/francetv.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py index d7e9aef90..9bc959a9b 100644 --- a/youtube_dl/extractor/francetv.py +++ b/youtube_dl/extractor/francetv.py @@ -26,6 +26,21 @@ class FranceTVBaseInfoExtractor(InfoExtractor): if info.get('status') == 'NOK': raise ExtractorError( '%s returned error: %s' % (self.IE_NAME, info['message']), expected=True) + allowed_countries = info['videos'][0].get('geoblocage') + if allowed_countries: + georestricted = True + geo_info = self._download_json( + 'http://geo.francetv.fr/ws/edgescape.json', video_id, + 'Downloading geo restriction info') + country = geo_info['reponse']['geo_info']['country_code'] + if country not in allowed_countries: + raise ExtractorError( + 'The video is not available from your location', + expected=True) + else: + georestricted = False + + formats = [] for video in info['videos']: @@ -36,6 +51,10 @@ class FranceTVBaseInfoExtractor(InfoExtractor): continue format_id = video['format'] if video_url.endswith('.f4m'): + if georestricted: + # See https://github.com/rg3/youtube-dl/issues/3963 + # m3u8 urls work fine + continue video_url_parsed = compat_urllib_parse_urlparse(video_url) f4m_url = self._download_webpage( 'http://hdfauth.francetv.fr/esi/urltokengen2.html?url=%s' % video_url_parsed.path, |