]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/lemonde.py
debian/changelog: Annotate the log with bugs to close.
[youtubedl] / youtube_dl / extractor / lemonde.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class LemondeIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:.+?\.)?lemonde\.fr/(?:[^/]+/)*(?P<id>[^/]+)\.html'
8 _TESTS = [{
9 'url': 'http://www.lemonde.fr/police-justice/video/2016/01/19/comprendre-l-affaire-bygmalion-en-cinq-minutes_4849702_1653578.html',
10 'md5': 'da120c8722d8632eec6ced937536cc98',
11 'info_dict': {
12 'id': 'lqm3kl',
13 'ext': 'mp4',
14 'title': "Comprendre l'affaire Bygmalion en 5 minutes",
15 'thumbnail': r're:^https?://.*\.jpg',
16 'duration': 309,
17 'upload_date': '20160119',
18 'timestamp': 1453194778,
19 'uploader_id': '3pmkp',
20 },
21 }, {
22 # standard iframe embed
23 'url': 'http://www.lemonde.fr/les-decodeurs/article/2016/10/18/tout-comprendre-du-ceta-le-petit-cousin-du-traite-transatlantique_5015920_4355770.html',
24 'info_dict': {
25 'id': 'uzsxms',
26 'ext': 'mp4',
27 'title': "CETA : quelles suites pour l'accord commercial entre l'Europe et le Canada ?",
28 'thumbnail': r're:^https?://.*\.jpg',
29 'duration': 325,
30 'upload_date': '20161021',
31 'timestamp': 1477044540,
32 'uploader_id': '3pmkp',
33 },
34 'params': {
35 'skip_download': True,
36 },
37 }, {
38 'url': 'http://redaction.actu.lemonde.fr/societe/video/2016/01/18/calais-debut-des-travaux-de-defrichement-dans-la-jungle_4849233_3224.html',
39 'only_matching': True,
40 }, {
41 # YouTube embeds
42 'url': 'http://www.lemonde.fr/pixels/article/2016/12/09/pourquoi-pewdiepie-superstar-de-youtube-a-menace-de-fermer-sa-chaine_5046649_4408996.html',
43 'only_matching': True,
44 }]
45
46 def _real_extract(self, url):
47 display_id = self._match_id(url)
48
49 webpage = self._download_webpage(url, display_id)
50
51 digiteka_url = self._proto_relative_url(self._search_regex(
52 r'url\s*:\s*(["\'])(?P<url>(?:https?://)?//(?:www\.)?(?:digiteka\.net|ultimedia\.com)/deliver/.+?)\1',
53 webpage, 'digiteka url', group='url', default=None))
54
55 if digiteka_url:
56 return self.url_result(digiteka_url, 'Digiteka')
57
58 return self.url_result(url, 'Generic')