From: Philipp Hagemeister Date: Mon, 5 May 2014 01:30:05 +0000 (+0200) Subject: [canalplus] Fix id determination (Fixes #2851) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=4de9e9a6db00853c8a809b08422b1ccddc3c446f;p=youtube-dl [canalplus] Fix id determination (Fixes #2851) --- diff --git a/youtube_dl/extractor/canalplus.py b/youtube_dl/extractor/canalplus.py index 4f66124fd..0202078b0 100644 --- a/youtube_dl/extractor/canalplus.py +++ b/youtube_dl/extractor/canalplus.py @@ -4,11 +4,14 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import unified_strdate +from ..utils import ( + unified_strdate, + url_basename, +) class CanalplusIE(InfoExtractor): - _VALID_URL = r'https?://(www\.canalplus\.fr/.*?/(?P.*)|player\.canalplus\.fr/#/(?P\d+))' + _VALID_URL = r'https?://(?:www\.canalplus\.fr/.*?/(?P.*)|player\.canalplus\.fr/#/(?P[0-9]+))' _VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/cplus/%s' IE_NAME = 'canalplus.fr' @@ -26,10 +29,13 @@ class CanalplusIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') + video_id = mobj.groupdict().get('id') + + # Beware, some subclasses do not define an id group + display_id = url_basename(mobj.group('path')) if video_id is None: - webpage = self._download_webpage(url, mobj.group('path')) + webpage = self._download_webpage(url, display_id) video_id = self._search_regex(r'