2 from __future__ import unicode_literals
5 import xml.etree.ElementTree as ET
7 from .common import InfoExtractor
8 from ..utils import xpath_with_ns
11 'media': 'http://search.yahoo.com/mrss/',
14 # URL prefix to download the mp4 files directly instead of streaming via rtmp
15 # Credits go to XBox-Maniac http://board.jdownloader.org/showpost.php?p=185835&postcount=31
16 RAW_MP4_URL = 'http://cdn.riptide-mtvn.com/'
18 class GameOneIE(InfoExtractor):
19 _VALID_URL = r'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)'
21 'url': 'http://www.gameone.de/tv/288',
22 'md5': '136656b7fb4c9cb4a8e2d500651c499b',
26 'title': 'Game One - Folge 288',
28 'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg',
29 'description': 'FIFA-Pressepokal 2014, Star Citizen, Kingdom Come: Deliverance, Project Cars, Schöner Trants Nerdquiz Folge 2 Runde 1',
34 def _real_extract(self, url):
35 mobj = re.match(self._VALID_URL, url)
36 video_id = mobj.group('id')
38 webpage = self._download_webpage(url, video_id)
39 og_video = self._og_search_video_url(webpage, secure=False)
40 description = self._html_search_meta('description', webpage)
41 age_limit = int(self._search_regex(r'age=(\d+)', self._html_search_meta('age-de-meta-label', webpage), 'age_limit', '0'))
42 mrss_url = self._search_regex(r'mrss=([^&]+)', og_video, 'mrss')
44 mrss = self._download_xml(mrss_url, video_id, 'Downloading mrss')
45 title = mrss.find('.//item/title').text
46 thumbnail = mrss.find('.//item/image').get('url')
47 content = mrss.find(xpath_with_ns('.//media:content', NAMESPACE_MAP))
48 content_url = content.get('url')
50 content = self._download_xml(content_url, video_id, 'Downloading media:content')
51 rendition_items = content.findall('.//rendition')
52 duration = int(rendition_items[0].get('duration'))
55 'url': re.sub(r'.*/(r2)', RAW_MP4_URL + r'\1', r.find('./src').text),
56 'width': int(r.get('width')),
57 'height': int(r.get('height')),
58 'tbr': int(r.get('bitrate')),
60 for r in rendition_items
66 'thumbnail': thumbnail,
69 'description': description,
70 'age_limit': age_limit,