]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ccc.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class CCCIE(InfoExtractor
):
14 IE_NAME
= 'media.ccc.de'
15 _VALID_URL
= r
'https?://(?:www\.)?media\.ccc\.de/v/(?P<id>[^/?#&]+)'
18 'url': 'https://media.ccc.de/v/30C3_-_5443_-_en_-_saal_g_-_201312281830_-_introduction_to_processor_design_-_byterazor#video',
19 'md5': '3a1eda8f3a29515d27f5adb967d7e740',
23 'title': 'Introduction to Processor Design',
24 'creator': 'byterazor',
25 'description': 'md5:df55f6d073d4ceae55aae6f2fd98a0ac',
26 'thumbnail': r
're:^https?://.*\.jpg$',
27 'upload_date': '20131228',
28 'timestamp': 1388188800,
33 'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
34 'only_matching': True,
37 def _real_extract(self
, url
):
38 display_id
= self
._match
_id
(url
)
39 webpage
= self
._download
_webpage
(url
, display_id
)
40 event_id
= self
._search
_regex
(r
"data-id='(\d+)'", webpage
, 'event id')
41 event_data
= self
._download
_json
('https://media.ccc.de/public/events/%s' % event_id
, event_id
)
44 for recording
in event_data
.get('recordings', []):
45 recording_url
= recording
.get('recording_url')
48 language
= recording
.get('language')
49 folder
= recording
.get('folder')
55 format_id
+= '-' + folder
58 vcodec
= 'h264' if 'h264' in folder
else (
59 'none' if folder
in ('mp3', 'opus') else None
62 'format_id': format_id
,
64 'width': int_or_none(recording
.get('width')),
65 'height': int_or_none(recording
.get('height')),
66 'filesize': int_or_none(recording
.get('size'), invscale
=1024 * 1024),
70 self
._sort
_formats
(formats
)
74 'display_id': display_id
,
75 'title': event_data
['title'],
76 'creator': try_get(event_data
, lambda x
: ', '.join(x
['persons'])),
77 'description': event_data
.get('description'),
78 'thumbnail': event_data
.get('thumb_url'),
79 'timestamp': parse_iso8601(event_data
.get('date')),
80 'duration': int_or_none(event_data
.get('length')),
81 'tags': event_data
.get('tags'),
86 class CCCPlaylistIE(InfoExtractor
):
87 IE_NAME
= 'media.ccc.de:lists'
88 _VALID_URL
= r
'https?://(?:www\.)?media\.ccc\.de/c/(?P<id>[^/?#&]+)'
90 'url': 'https://media.ccc.de/c/30c3',
95 'playlist_count': 135,
98 def _real_extract(self
, url
):
99 playlist_id
= self
._match
_id
(url
).lower()
101 conf
= self
._download
_json
(
102 'https://media.ccc.de/public/conferences/' + playlist_id
,
106 for e
in conf
['events']:
107 event_url
= url_or_none(e
.get('frontend_link'))
109 entries
.append(self
.url_result(event_url
, ie
=CCCIE
.ie_key()))
111 return self
.playlist_result(entries
, playlist_id
, conf
.get('title'))