]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/digiteka.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class DigitekaIE(InfoExtractor
):
12 https?://(?:www\.)?(?:digiteka\.net|ultimedia\.com)/
30 )/(?P<id>[\d+a-z]+)'''
33 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
34 'md5': '276a0e49de58c7e85d32b057837952a2',
38 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
39 'thumbnail': r
're:^https?://.*\.jpg',
41 'upload_date': '20150317',
42 'timestamp': 1426604939,
43 'uploader_id': '3fszv',
47 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
48 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
52 'title': 'Two - C\'est La Vie (clip)',
53 'thumbnail': r
're:^https?://.*\.jpg',
55 'upload_date': '20150224',
56 'timestamp': 1424760500,
57 'uploader_id': '3rfzk',
60 'url': 'https://www.digiteka.net/deliver/generic/iframe/mdtk/01637594/src/lqm3kl/zone/1/showtitle/1/autoplay/yes',
61 'only_matching': True,
65 def _extract_url(webpage
):
67 r
'<(?:iframe|script)[^>]+src=["\'](?P
<url
>(?
:https?
:)?
//(?
:www\
.)?ultimedia\
.com
/deliver
/(?
:generic|musique
)(?
:/[^
/]+)*/(?
:src|article
)/[\d
+a
-z
]+)',
70 return mobj.group('url
')
72 def _real_extract(self, url):
73 mobj = re.match(self._VALID_URL, url)
74 video_id = mobj.group('id')
75 video_type = mobj.group('embed_type
') or mobj.group('site_type
')
76 if video_type == 'music
':
77 video_type = 'musique
'
79 deliver_info = self._download_json(
80 'http
://www
.ultimedia
.com
/deliver
/video?video
=%s&topic
=%s' % (video_id, video_type),
83 yt_id = deliver_info.get('yt_id
')
85 return self.url_result(yt_id, 'Youtube
')
87 jwconf = deliver_info['jwconf
']
90 for source in jwconf['playlist
'][0]['sources
']:
92 'url
': source['file'],
93 'format_id
': source.get('label
'),
96 self._sort_formats(formats)
98 title = deliver_info['title
']
99 thumbnail = jwconf.get('image
')
100 duration = int_or_none(deliver_info.get('duration
'))
101 timestamp = int_or_none(deliver_info.get('release_time
'))
102 uploader_id = deliver_info.get('owner_id
')
107 'thumbnail
': thumbnail,
108 'duration
': duration,
109 'timestamp
': timestamp,
110 'uploader_id
': uploader_id,