2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 'media': 'http://search.yahoo.com/mrss/',
17 # URL prefix to download the mp4 files directly instead of streaming via rtmp
18 # Credits go to XBox-Maniac
19 # http://board.jdownloader.org/showpost.php?p=185835&postcount=31
20 RAW_MP4_URL = 'http://cdn.riptide-mtvn.com/'
23 class GameOneIE(InfoExtractor):
24 _VALID_URL = r'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)'
26 'url': 'http://www.gameone.de/tv/288',
27 'md5': '136656b7fb4c9cb4a8e2d500651c499b',
31 'title': 'Game One - Folge 288',
33 'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg',
34 'description': 'FIFA-Pressepokal 2014, Star Citizen, Kingdom Come: Deliverance, Project Cars, Schöner Trants Nerdquiz Folge 2 Runde 1',
36 'upload_date': '20140513',
37 'timestamp': 1399980122,
41 def _real_extract(self, url):
42 mobj = re.match(self._VALID_URL, url)
43 video_id = mobj.group('id')
45 webpage = self._download_webpage(url, video_id)
46 og_video = self._og_search_video_url(webpage, secure=False)
47 description = self._html_search_meta('description', webpage)
51 self._html_search_meta(
56 mrss_url = self._search_regex(r'mrss=([^&]+)', og_video, 'mrss')
58 mrss = self._download_xml(mrss_url, video_id, 'Downloading mrss')
59 title = mrss.find('.//item/title').text
60 thumbnail = mrss.find('.//item/image').get('url')
61 timestamp = parse_iso8601(mrss.find('.//pubDate').text, delimiter=' ')
62 content = mrss.find(xpath_with_ns('.//media:content', NAMESPACE_MAP))
63 content_url = content.get('url')
65 content = self._download_xml(
68 'Downloading media:content')
69 rendition_items = content.findall('.//rendition')
70 duration = int(rendition_items[0].get('duration'))
73 'url': re.sub(r'.*/(r2)', RAW_MP4_URL + r'\1', r.find('./src').text),
74 'width': int(r.get('width')),
75 'height': int(r.get('height')),
76 'tbr': int(r.get('bitrate')),
78 for r in rendition_items
80 self._sort_formats(formats)
85 'thumbnail': thumbnail,
88 'description': description,
89 'age_limit': age_limit,
90 'timestamp': timestamp,
93 class GameOnePlaylistIE(InfoExtractor):
94 _VALID_URL = r'https?://(?:www\.)?gameone\.de(?:/tv)?/?$'
96 def _real_extract(self, url):
97 this_year = datetime.date.today().year
98 webpage = self._download_webpage('http://www.gameone.de/tv/year/%d' % this_year, this_year)
99 max_id = max(map(int, re.findall(r'<a href="/tv/(\d+)"', webpage)))
100 entries = [self.url_result('http://www.gameone.de/tv/%d' % video_id, 'GameOne') for video_id in range(max_id, 0, -1)]