]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gameone.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  15     'media': 'http://search.yahoo.com/mrss/', 
  18 # URL prefix to download the mp4 files directly instead of streaming via rtmp 
  19 # Credits go to XBox-Maniac 
  20 # http://board.jdownloader.org/showpost.php?p=185835&postcount=31 
  21 RAW_MP4_URL 
= 'http://cdn.riptide-mtvn.com/' 
  24 class GameOneIE(InfoExtractor
): 
  25     _VALID_URL 
= r
'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)' 
  28             'url': 'http://www.gameone.de/tv/288', 
  29             'md5': '136656b7fb4c9cb4a8e2d500651c499b', 
  33                 'title': 'Game One - Folge 288', 
  35                 'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg', 
  36                 'description': 'FIFA-Pressepokal 2014, Star Citizen, Kingdom Come: Deliverance, Project Cars, Schöner Trants Nerdquiz Folge 2 Runde 1', 
  38                 'upload_date': '20140513', 
  39                 'timestamp': 1399980122, 
  43             'url': 'http://gameone.de/tv/220', 
  44             'md5': '5227ca74c4ae6b5f74c0510a7c48839e', 
  48                 'upload_date': '20120918', 
  49                 'description': 'Jet Set Radio HD, Tekken Tag Tournament 2, Source Filmmaker', 
  50                 'timestamp': 1347971451, 
  51                 'title': 'Game One - Folge 220', 
  59     def _real_extract(self
, url
): 
  60         video_id 
= self
._match
_id
(url
) 
  62         webpage 
= self
._download
_webpage
(url
, video_id
) 
  63         og_video 
= self
._og
_search
_video
_url
(webpage
, secure
=False) 
  64         description 
= self
._html
_search
_meta
('description', webpage
) 
  68                 self
._html
_search
_meta
( 
  73         mrss_url 
= self
._search
_regex
(r
'mrss=([^&]+)', og_video
, 'mrss') 
  75         mrss 
= self
._download
_xml
(mrss_url
, video_id
, 'Downloading mrss') 
  76         title 
= mrss
.find('.//item/title').text
 
  77         thumbnail 
= mrss
.find('.//item/image').get('url') 
  78         timestamp 
= parse_iso8601(mrss
.find('.//pubDate').text
, delimiter
=' ') 
  79         content 
= mrss
.find(xpath_with_ns('.//media:content', NAMESPACE_MAP
)) 
  80         content_url 
= content
.get('url') 
  82         content 
= self
._download
_xml
( 
  85             'Downloading media:content') 
  86         rendition_items 
= content
.findall('.//rendition') 
  87         duration 
= float_or_none(rendition_items
[0].get('duration')) 
  90                 'url': re
.sub(r
'.*/(r2)', RAW_MP4_URL 
+ r
'\1', r
.find('./src').text
), 
  91                 'width': int_or_none(r
.get('width')), 
  92                 'height': int_or_none(r
.get('height')), 
  93                 'tbr': int_or_none(r
.get('bitrate')), 
  95             for r 
in rendition_items
 
  97         self
._sort
_formats
(formats
) 
 102             'thumbnail': thumbnail
, 
 103             'duration': duration
, 
 105             'description': description
, 
 106             'age_limit': age_limit
, 
 107             'timestamp': timestamp
, 
 111 class GameOnePlaylistIE(InfoExtractor
): 
 112     _VALID_URL 
= r
'https?://(?:www\.)?gameone\.de(?:/tv)?/?$' 
 113     IE_NAME 
= 'gameone:playlist' 
 115         'url': 'http://www.gameone.de/tv', 
 119         'playlist_mincount': 294, 
 122     def _real_extract(self
, url
): 
 123         webpage 
= self
._download
_webpage
('http://www.gameone.de/tv', 'TV') 
 124         max_id 
= max(map(int, re
.findall(r
'<a href="/tv/(\d+)"', webpage
))) 
 126             self
.url_result('http://www.gameone.de/tv/%d' % 
 128             for video_id 
in range(max_id
, 0, -1)]