mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
10 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from .common import InfoExtractor
|
||
10 years ago
|
from ..compat import (
|
||
8 years ago
|
compat_str,
|
||
10 years ago
|
compat_urlparse,
|
||
10 years ago
|
)
|
||
|
from ..utils import (
|
||
10 years ago
|
determine_ext,
|
||
|
)
|
||
10 years ago
|
|
||
|
|
||
|
class GolemIE(InfoExtractor):
|
||
|
_VALID_URL = r'^https?://video\.golem\.de/.+?/(?P<id>.+?)/'
|
||
|
_TEST = {
|
||
|
'url': 'http://video.golem.de/handy/14095/iphone-6-und-6-plus-test.html',
|
||
|
'md5': 'c1a2c0a3c863319651c7c992c5ee29bf',
|
||
|
'info_dict': {
|
||
|
'id': '14095',
|
||
|
'format_id': 'high',
|
||
|
'ext': 'mp4',
|
||
|
'title': 'iPhone 6 und 6 Plus - Test',
|
||
10 years ago
|
'duration': 300.44,
|
||
10 years ago
|
'filesize': 65309548,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
_PREFIX = 'http://video.golem.de'
|
||
|
|
||
|
def _real_extract(self, url):
|
||
10 years ago
|
video_id = self._match_id(url)
|
||
10 years ago
|
|
||
10 years ago
|
config = self._download_xml(
|
||
|
'https://video.golem.de/xml/{0}.xml'.format(video_id), video_id)
|
||
10 years ago
|
|
||
|
info = {
|
||
10 years ago
|
'id': video_id,
|
||
|
'title': config.findtext('./title', 'golem'),
|
||
|
'duration': self._float(config.findtext('./playtime'), 'duration'),
|
||
10 years ago
|
}
|
||
|
|
||
|
formats = []
|
||
10 years ago
|
for e in config:
|
||
10 years ago
|
url = e.findtext('./url')
|
||
|
if not url:
|
||
|
continue
|
||
|
|
||
|
formats.append({
|
||
8 years ago
|
'format_id': compat_str(e.tag),
|
||
10 years ago
|
'url': compat_urlparse.urljoin(self._PREFIX, url),
|
||
|
'height': self._int(e.get('height'), 'height'),
|
||
|
'width': self._int(e.get('width'), 'width'),
|
||
|
'filesize': self._int(e.findtext('filesize'), 'filesize'),
|
||
|
'ext': determine_ext(e.findtext('./filename')),
|
||
|
})
|
||
10 years ago
|
self._sort_formats(formats)
|
||
|
info['formats'] = formats
|
||
|
|
||
|
thumbnails = []
|
||
10 years ago
|
for e in config.findall('.//teaser'):
|
||
10 years ago
|
url = e.findtext('./url')
|
||
|
if not url:
|
||
|
continue
|
||
|
thumbnails.append({
|
||
|
'url': compat_urlparse.urljoin(self._PREFIX, url),
|
||
|
'width': self._int(e.get('width'), 'thumbnail width'),
|
||
|
'height': self._int(e.get('height'), 'thumbnail height'),
|
||
|
})
|
||
10 years ago
|
info['thumbnails'] = thumbnails
|
||
|
|
||
|
return info
|