]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ccc.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class CCCIE(InfoExtractor
):
11 IE_NAME
= 'media.ccc.de'
12 _VALID_URL
= r
'https?://(?:www\.)?media\.ccc\.de/v/(?P<id>[^/?#&]+)'
15 'url': 'https://media.ccc.de/v/30C3_-_5443_-_en_-_saal_g_-_201312281830_-_introduction_to_processor_design_-_byterazor#video',
16 'md5': '3a1eda8f3a29515d27f5adb967d7e740',
20 'title': 'Introduction to Processor Design',
21 'description': 'md5:df55f6d073d4ceae55aae6f2fd98a0ac',
22 'thumbnail': r
're:^https?://.*\.jpg$',
23 'upload_date': '20131228',
24 'timestamp': 1388188800,
28 'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
29 'only_matching': True,
32 def _real_extract(self
, url
):
33 display_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(url
, display_id
)
35 event_id
= self
._search
_regex
(r
"data-id='(\d+)'", webpage
, 'event id')
36 event_data
= self
._download
_json
('https://media.ccc.de/public/events/%s' % event_id
, event_id
)
39 for recording
in event_data
.get('recordings', []):
40 recording_url
= recording
.get('recording_url')
43 language
= recording
.get('language')
44 folder
= recording
.get('folder')
50 format_id
+= '-' + folder
53 vcodec
= 'h264' if 'h264' in folder
else (
54 'none' if folder
in ('mp3', 'opus') else None
57 'format_id': format_id
,
59 'width': int_or_none(recording
.get('width')),
60 'height': int_or_none(recording
.get('height')),
61 'filesize': int_or_none(recording
.get('size'), invscale
=1024 * 1024),
65 self
._sort
_formats
(formats
)
69 'display_id': display_id
,
70 'title': event_data
['title'],
71 'description': event_data
.get('description'),
72 'thumbnail': event_data
.get('thumb_url'),
73 'timestamp': parse_iso8601(event_data
.get('date')),
74 'duration': int_or_none(event_data
.get('length')),
75 'tags': event_data
.get('tags'),