mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-15 18:34:22 +00:00
[francetv] Use the m3u8 manifest for georestricted videos (closes #3963)
Generating the correct urls for the f4m segments seems to require a lot of work. Also raise an error if the video is not available from your location.
This commit is contained in:
parent
b74e86f48a
commit
00e9d396ab
@ -26,6 +26,21 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
|
|||||||
if info.get('status') == 'NOK':
|
if info.get('status') == 'NOK':
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'%s returned error: %s' % (self.IE_NAME, info['message']), expected=True)
|
'%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 = []
|
formats = []
|
||||||
for video in info['videos']:
|
for video in info['videos']:
|
||||||
@ -36,6 +51,10 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
|
|||||||
continue
|
continue
|
||||||
format_id = video['format']
|
format_id = video['format']
|
||||||
if video_url.endswith('.f4m'):
|
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)
|
video_url_parsed = compat_urllib_parse_urlparse(video_url)
|
||||||
f4m_url = self._download_webpage(
|
f4m_url = self._download_webpage(
|
||||||
'http://hdfauth.francetv.fr/esi/urltokengen2.html?url=%s' % video_url_parsed.path,
|
'http://hdfauth.francetv.fr/esi/urltokengen2.html?url=%s' % video_url_parsed.path,
|
||||||
|
Loading…
Reference in New Issue
Block a user