1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 14:27:53 +00:00

[dreisat] Modernize

This commit is contained in:
Sergey M․ 2014-06-08 22:45:12 +07:00
parent 15e423407f
commit e0b4cc489f

View File

@ -1,34 +1,32 @@
# coding: utf-8 from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import unified_strdate
unified_strdate,
)
class DreiSatIE(InfoExtractor): class DreiSatIE(InfoExtractor):
IE_NAME = '3sat' IE_NAME = '3sat'
_VALID_URL = r'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php)?\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$' _VALID_URL = r'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php)?\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$'
_TEST = { _TEST = {
u"url": u"http://www.3sat.de/mediathek/index.php?obj=36983", 'url': 'http://www.3sat.de/mediathek/index.php?obj=36983',
u'file': u'36983.mp4', 'md5': '9dcfe344732808dbfcc901537973c922',
u'md5': u'9dcfe344732808dbfcc901537973c922', 'info_dict': {
u'info_dict': { 'id': '36983',
u"title": u"Kaffeeland Schweiz", 'ext': 'mp4',
u"description": u"Über 80 Kaffeeröstereien liefern in der Schweiz das Getränk, in das das Land so vernarrt ist: Mehr als 1000 Tassen trinkt ein Schweizer pro Jahr. SCHWEIZWEIT nimmt die Kaffeekultur unter die...", 'title': 'Kaffeeland Schweiz',
u"uploader": u"3sat", 'description': 'md5:cc4424b18b75ae9948b13929a0814033',
u"upload_date": u"20130622" 'uploader': '3sat',
'upload_date': '20130622'
} }
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
details_url = 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id details_url = 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
details_doc = self._download_xml(details_url, video_id, note=u'Downloading video details') details_doc = self._download_xml(details_url, video_id, 'Downloading video details')
thumbnail_els = details_doc.findall('.//teaserimage') thumbnail_els = details_doc.findall('.//teaserimage')
thumbnails = [{ thumbnails = [{