|
|
@ -1,13 +1,9 @@
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
int_or_none,
|
|
|
|
parse_duration,
|
|
|
|
parse_iso8601,
|
|
|
|
qualities,
|
|
|
|
|
|
|
|
unified_strdate,
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,14 +15,14 @@ class CCCIE(InfoExtractor):
|
|
|
|
'url': 'https://media.ccc.de/v/30C3_-_5443_-_en_-_saal_g_-_201312281830_-_introduction_to_processor_design_-_byterazor#video',
|
|
|
|
'url': 'https://media.ccc.de/v/30C3_-_5443_-_en_-_saal_g_-_201312281830_-_introduction_to_processor_design_-_byterazor#video',
|
|
|
|
'md5': '3a1eda8f3a29515d27f5adb967d7e740',
|
|
|
|
'md5': '3a1eda8f3a29515d27f5adb967d7e740',
|
|
|
|
'info_dict': {
|
|
|
|
'info_dict': {
|
|
|
|
'id': '30C3_-_5443_-_en_-_saal_g_-_201312281830_-_introduction_to_processor_design_-_byterazor',
|
|
|
|
'id': '1839',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Introduction to Processor Design',
|
|
|
|
'title': 'Introduction to Processor Design',
|
|
|
|
'description': 'md5:80be298773966f66d56cb11260b879af',
|
|
|
|
'description': 'md5:df55f6d073d4ceae55aae6f2fd98a0ac',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg$',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg$',
|
|
|
|
'view_count': int,
|
|
|
|
|
|
|
|
'upload_date': '20131228',
|
|
|
|
'upload_date': '20131228',
|
|
|
|
'duration': 3660,
|
|
|
|
'timestamp': 1388188800,
|
|
|
|
|
|
|
|
'duration': 3710,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
|
|
|
|
'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
|
|
|
@ -34,79 +30,48 @@ class CCCIE(InfoExtractor):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
display_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
|
|
|
|
|
|
|
event_id = self._search_regex("data-id='(\d+)'", webpage, 'event id')
|
|
|
|
if self._downloader.params.get('prefer_free_formats'):
|
|
|
|
event_data = self._download_json('https://media.ccc.de/public/events/%s' % event_id, event_id)
|
|
|
|
preference = qualities(['mp3', 'opus', 'mp4-lq', 'webm-lq', 'h264-sd', 'mp4-sd', 'webm-sd', 'mp4', 'webm', 'mp4-hd', 'h264-hd', 'webm-hd'])
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
preference = qualities(['opus', 'mp3', 'webm-lq', 'mp4-lq', 'webm-sd', 'h264-sd', 'mp4-sd', 'webm', 'mp4', 'webm-hd', 'mp4-hd', 'h264-hd'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
title = self._html_search_regex(
|
|
|
|
|
|
|
|
r'(?s)<h1>(.*?)</h1>', webpage, 'title')
|
|
|
|
|
|
|
|
description = self._html_search_regex(
|
|
|
|
|
|
|
|
r'(?s)<h3>About</h3>(.+?)<h3>',
|
|
|
|
|
|
|
|
webpage, 'description', fatal=False)
|
|
|
|
|
|
|
|
upload_date = unified_strdate(self._html_search_regex(
|
|
|
|
|
|
|
|
r"(?s)<span[^>]+class='[^']*fa-calendar-o'[^>]*>(.+?)</span>",
|
|
|
|
|
|
|
|
webpage, 'upload date', fatal=False))
|
|
|
|
|
|
|
|
view_count = int_or_none(self._html_search_regex(
|
|
|
|
|
|
|
|
r"(?s)<span class='[^']*fa-eye'></span>(.*?)</li>",
|
|
|
|
|
|
|
|
webpage, 'view count', fatal=False))
|
|
|
|
|
|
|
|
duration = parse_duration(self._html_search_regex(
|
|
|
|
|
|
|
|
r'(?s)<span[^>]+class=(["\']).*?fa-clock-o.*?\1[^>]*></span>(?P<duration>.+?)</li',
|
|
|
|
|
|
|
|
webpage, 'duration', fatal=False, group='duration'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matches = re.finditer(r'''(?xs)
|
|
|
|
|
|
|
|
<(?:span|div)\s+class='label\s+filetype'>(?P<format>[^<]*)</(?:span|div)>\s*
|
|
|
|
|
|
|
|
<(?:span|div)\s+class='label\s+filetype'>(?P<lang>[^<]*)</(?:span|div)>\s*
|
|
|
|
|
|
|
|
<a\s+download\s+href='(?P<http_url>[^']+)'>\s*
|
|
|
|
|
|
|
|
(?:
|
|
|
|
|
|
|
|
.*?
|
|
|
|
|
|
|
|
<a\s+(?:download\s+)?href='(?P<torrent_url>[^']+\.torrent)'
|
|
|
|
|
|
|
|
)?''', webpage)
|
|
|
|
|
|
|
|
formats = []
|
|
|
|
formats = []
|
|
|
|
for m in matches:
|
|
|
|
for recording in event_data.get('recordings', []):
|
|
|
|
format = m.group('format')
|
|
|
|
recording_url = recording.get('recording_url')
|
|
|
|
format_id = self._search_regex(
|
|
|
|
if not recording_url:
|
|
|
|
r'.*/([a-z0-9_-]+)/[^/]*$',
|
|
|
|
continue
|
|
|
|
m.group('http_url'), 'format id', default=None)
|
|
|
|
language = recording.get('language')
|
|
|
|
if format_id:
|
|
|
|
folder = recording.get('folder')
|
|
|
|
format_id = m.group('lang') + '-' + format_id
|
|
|
|
format_id = None
|
|
|
|
vcodec = 'h264' if 'h264' in format_id else (
|
|
|
|
if language:
|
|
|
|
'none' if format_id in ('mp3', 'opus') else None
|
|
|
|
format_id = language
|
|
|
|
|
|
|
|
if folder:
|
|
|
|
|
|
|
|
if language:
|
|
|
|
|
|
|
|
format_id += '-' + folder
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
format_id = folder
|
|
|
|
|
|
|
|
vcodec = 'h264' if 'h264' in folder else (
|
|
|
|
|
|
|
|
'none' if folder in ('mp3', 'opus') else None
|
|
|
|
)
|
|
|
|
)
|
|
|
|
formats.append({
|
|
|
|
formats.append({
|
|
|
|
'format_id': format_id,
|
|
|
|
'format_id': format_id,
|
|
|
|
'format': format,
|
|
|
|
'url': recording_url,
|
|
|
|
'language': m.group('lang'),
|
|
|
|
'width': int_or_none(recording.get('width')),
|
|
|
|
'url': m.group('http_url'),
|
|
|
|
'height': int_or_none(recording.get('height')),
|
|
|
|
|
|
|
|
'filesize': int_or_none(recording.get('size'), invscale=1024 * 1024),
|
|
|
|
|
|
|
|
'language': language,
|
|
|
|
'vcodec': vcodec,
|
|
|
|
'vcodec': vcodec,
|
|
|
|
'preference': preference(format_id),
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if m.group('torrent_url'):
|
|
|
|
|
|
|
|
formats.append({
|
|
|
|
|
|
|
|
'format_id': 'torrent-%s' % (format if format_id is None else format_id),
|
|
|
|
|
|
|
|
'format': '%s (torrent)' % format,
|
|
|
|
|
|
|
|
'proto': 'torrent',
|
|
|
|
|
|
|
|
'format_note': '(unsupported; will just download the .torrent file)',
|
|
|
|
|
|
|
|
'vcodec': vcodec,
|
|
|
|
|
|
|
|
'preference': -100 + preference(format_id),
|
|
|
|
|
|
|
|
'url': m.group('torrent_url'),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
self._sort_formats(formats)
|
|
|
|
self._sort_formats(formats)
|
|
|
|
|
|
|
|
|
|
|
|
thumbnail = self._html_search_regex(
|
|
|
|
|
|
|
|
r"<video.*?poster='([^']+)'", webpage, 'thumbnail', fatal=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'id': event_id,
|
|
|
|
'title': title,
|
|
|
|
'display_id': display_id,
|
|
|
|
'description': description,
|
|
|
|
'title': event_data['title'],
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'description': event_data.get('description'),
|
|
|
|
'view_count': view_count,
|
|
|
|
'thumbnail': event_data.get('thumb_url'),
|
|
|
|
'upload_date': upload_date,
|
|
|
|
'timestamp': parse_iso8601(event_data.get('date')),
|
|
|
|
'duration': duration,
|
|
|
|
'duration': int_or_none(event_data.get('length')),
|
|
|
|
|
|
|
|
'tags': event_data.get('tags'),
|
|
|
|
'formats': formats,
|
|
|
|
'formats': formats,
|
|
|
|
}
|
|
|
|
}
|
|
|
|