aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/francetv.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-10-04 00:31:10 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-10-04 00:34:36 +0200
commitda0a5d2d6eb4ed3f511e69d3d6c8814f6aab6535 (patch)
tree30352293b23bea8d0f56ad1076ea0e223ba9843d /youtube_dl/extractor/francetv.py
parentee6adb166c5f605b826c3bb2e05673fa193c0964 (diff)
downloadyoutube-dl-da0a5d2d6eb4ed3f511e69d3d6c8814f6aab6535.zip
youtube-dl-da0a5d2d6eb4ed3f511e69d3d6c8814f6aab6535.tar.gz
youtube-dl-da0a5d2d6eb4ed3f511e69d3d6c8814f6aab6535.tar.bz2
[france2] Add support for URLs without video IDs (Fixes #1547)
Diffstat (limited to 'youtube_dl/extractor/francetv.py')
-rw-r--r--youtube_dl/extractor/francetv.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py
index b1530e5..461dac8 100644
--- a/youtube_dl/extractor/francetv.py
+++ b/youtube_dl/extractor/francetv.py
@@ -70,7 +70,11 @@ class FranceTvInfoIE(FranceTVBaseInfoExtractor):
class France2IE(FranceTVBaseInfoExtractor):
IE_NAME = u'france2.fr'
- _VALID_URL = r'https?://www\.france2\.fr/emissions/.*?/videos/(?P<id>\d+)'
+ _VALID_URL = r'''(?x)https?://www\.france2\.fr/
+ (?:
+ emissions/.*?/videos/(?P<id>\d+)
+ | emission/(?P<key>[^/?]+)
+ )'''
_TEST = {
u'url': u'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
@@ -86,7 +90,15 @@ class France2IE(FranceTVBaseInfoExtractor):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
- video_id = mobj.group('id')
+ if mobj.group('key'):
+ webpage = self._download_webpage(url, mobj.group('key'))
+ video_id = self._html_search_regex(
+ r'''(?x)<div\s+class="video-player">\s*
+ <a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
+ class="francetv-video-player">''',
+ webpage, u'video ID')
+ else:
+ video_id = mobj.group('id')
return self._extract_video(video_id)