mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[canalplus] Fix video_id and update _TESTS
Some tests are gone, and some redirect to different videos
This commit is contained in:
parent
a5f8473145
commit
e2004ccaf7
|
@ -1,6 +1,7 @@
|
||||||
version <unreleased>
|
version <unreleased>
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
* [canalplus] Fix extraction for some videos
|
||||||
* [cbsinteractive] Fix extraction for cnet.com
|
* [cbsinteractive] Fix extraction for cnet.com
|
||||||
* [parliamentliveuk] Lower case URLs are now recognized (#10912)
|
* [parliamentliveuk] Lower case URLs are now recognized (#10912)
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,13 @@ import re
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_urllib_parse_urlparse
|
from ..compat import compat_urllib_parse_urlparse
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
dict_get,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
unified_strdate,
|
|
||||||
qualities,
|
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
qualities,
|
||||||
|
remove_end,
|
||||||
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,47 +45,46 @@ class CanalplusIE(InfoExtractor):
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.canalplus.fr/c-emissions/pid1830-c-zapping.html?vid=1192814',
|
'url': 'http://www.canalplus.fr/c-emissions/pid1830-c-zapping.html?vid=1192814',
|
||||||
'md5': '41f438a4904f7664b91b4ed0dec969dc',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1192814',
|
'id': '1405510',
|
||||||
|
'display_id': 'pid1830-c-zapping',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "L'Année du Zapping 2014 - L'Année du Zapping 2014",
|
'title': 'Zapping - 02/07/2016',
|
||||||
'description': "Toute l'année 2014 dans un Zapping exceptionnel !",
|
'description': 'Le meilleur de toutes les chaînes, tous les jours',
|
||||||
'upload_date': '20150105',
|
'upload_date': '20160702',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.piwiplus.fr/videos-piwi/pid1405-le-labyrinthe-boing-super-ranger.html?vid=1108190',
|
'url': 'http://www.piwiplus.fr/videos-piwi/pid1405-le-labyrinthe-boing-super-ranger.html?vid=1108190',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1108190',
|
'id': '1108190',
|
||||||
'ext': 'flv',
|
'display_id': 'pid1405-le-labyrinthe-boing-super-ranger',
|
||||||
'title': 'Le labyrinthe - Boing super ranger',
|
'ext': 'mp4',
|
||||||
|
'title': 'BOING SUPER RANGER - Ep : Le labyrinthe',
|
||||||
'description': 'md5:4cea7a37153be42c1ba2c1d3064376ff',
|
'description': 'md5:4cea7a37153be42c1ba2c1d3064376ff',
|
||||||
'upload_date': '20140724',
|
'upload_date': '20140724',
|
||||||
},
|
},
|
||||||
'skip': 'Only works from France',
|
'skip': 'Only works from France',
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.d8.tv/d8-docs-mags/pid5198-d8-en-quete-d-actualite.html?vid=1390231',
|
'url': 'http://www.c8.fr/c8-divertissement/ms-touche-pas-a-mon-poste/pid6318-videos-integrales.html',
|
||||||
|
'md5': '4b47b12b4ee43002626b97fad8fb1de5',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1390231',
|
'id': '1420213',
|
||||||
|
'display_id': 'pid6318-videos-integrales',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "Vacances pas chères : prix discount ou grosses dépenses ? - En quête d'actualité",
|
'title': 'TPMP ! Même le matin - Les 35H de Baba - 14/10/2016',
|
||||||
'description': 'md5:edb6cf1cb4a1e807b5dd089e1ac8bfc6',
|
'description': 'md5:f96736c1b0ffaa96fd5b9e60ad871799',
|
||||||
'upload_date': '20160512',
|
'upload_date': '20161014',
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
|
'skip': 'Only works from France',
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.itele.fr/chroniques/invite-bruce-toussaint/thierry-solere-nicolas-sarkozy-officialisera-sa-candidature-a-la-primaire-quand-il-le-voudra-167224',
|
'url': 'http://www.itele.fr/chroniques/invite-michael-darmon/rachida-dati-nicolas-sarkozy-est-le-plus-en-phase-avec-les-inquietudes-des-francais-171510',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1398334',
|
'id': '1420176',
|
||||||
|
'display_id': 'rachida-dati-nicolas-sarkozy-est-le-plus-en-phase-avec-les-inquietudes-des-francais-171510',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "L'invité de Bruce Toussaint du 07/06/2016 - ",
|
'title': 'L\'invité de Michaël Darmon du 14/10/2016 - ',
|
||||||
'description': 'md5:40ac7c9ad0feaeb6f605bad986f61324',
|
'description': 'Chaque matin du lundi au vendredi, Michaël Darmon reçoit un invité politique à 8h25.',
|
||||||
'upload_date': '20160607',
|
'upload_date': '20161014',
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://m.canalplus.fr/?vid=1398231',
|
'url': 'http://m.canalplus.fr/?vid=1398231',
|
||||||
|
@ -95,18 +96,17 @@ class CanalplusIE(InfoExtractor):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.groupdict().get('id') or mobj.groupdict().get('vid')
|
|
||||||
|
|
||||||
site_id = self._SITE_ID_MAP[compat_urllib_parse_urlparse(url).netloc.rsplit('.', 2)[-2]]
|
site_id = self._SITE_ID_MAP[compat_urllib_parse_urlparse(url).netloc.rsplit('.', 2)[-2]]
|
||||||
|
|
||||||
# Beware, some subclasses do not define an id group
|
# Beware, some subclasses do not define an id group
|
||||||
display_id = mobj.group('display_id') or video_id
|
display_id = remove_end(dict_get(mobj.groupdict(), ('display_id', 'id', 'vid')), '.html')
|
||||||
|
|
||||||
if video_id is None:
|
webpage = self._download_webpage(url, display_id)
|
||||||
webpage = self._download_webpage(url, display_id)
|
video_id = self._search_regex(
|
||||||
video_id = self._search_regex(
|
[r'<canal:player[^>]+?videoId=(["\'])(?P<id>\d+)',
|
||||||
[r'<canal:player[^>]+?videoId=(["\'])(?P<id>\d+)', r'id=["\']canal_video_player(?P<id>\d+)'],
|
r'id=["\']canal_video_player(?P<id>\d+)'],
|
||||||
webpage, 'video id', group='id')
|
webpage, 'video id', group='id')
|
||||||
|
|
||||||
info_url = self._VIDEO_INFO_TEMPLATE % (site_id, video_id)
|
info_url = self._VIDEO_INFO_TEMPLATE % (site_id, video_id)
|
||||||
video_data = self._download_json(info_url, video_id, 'Downloading video JSON')
|
video_data = self._download_json(info_url, video_id, 'Downloading video JSON')
|
||||||
|
|
Loading…
Reference in a new issue