]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gameone.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13     'media': 'http://search.yahoo.com/mrss/', 
  16 # URL prefix to download the mp4 files directly instead of streaming via rtmp 
  17 # Credits go to XBox-Maniac 
  18 # http://board.jdownloader.org/showpost.php?p=185835&postcount=31 
  19 RAW_MP4_URL 
= 'http://cdn.riptide-mtvn.com/' 
  22 class GameOneIE(InfoExtractor
): 
  23     _VALID_URL 
= r
'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)' 
  25         'url': 'http://www.gameone.de/tv/288', 
  26         'md5': '136656b7fb4c9cb4a8e2d500651c499b', 
  30             'title': 'Game One - Folge 288', 
  32             'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg', 
  33             'description': 'FIFA-Pressepokal 2014, Star Citizen, Kingdom Come: Deliverance, Project Cars, Schöner Trants Nerdquiz Folge 2 Runde 1', 
  35             'upload_date': '20140513', 
  36             'timestamp': 1399980122, 
  40     def _real_extract(self
, url
): 
  41         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  42         video_id 
= mobj
.group('id') 
  44         webpage 
= self
._download
_webpage
(url
, video_id
) 
  45         og_video 
= self
._og
_search
_video
_url
(webpage
, secure
=False) 
  46         description 
= self
._html
_search
_meta
('description', webpage
) 
  50                 self
._html
_search
_meta
( 
  55         mrss_url 
= self
._search
_regex
(r
'mrss=([^&]+)', og_video
, 'mrss') 
  57         mrss 
= self
._download
_xml
(mrss_url
, video_id
, 'Downloading mrss') 
  58         title 
= mrss
.find('.//item/title').text
 
  59         thumbnail 
= mrss
.find('.//item/image').get('url') 
  60         timestamp 
= parse_iso8601(mrss
.find('.//pubDate').text
, delimiter
=' ') 
  61         content 
= mrss
.find(xpath_with_ns('.//media:content', NAMESPACE_MAP
)) 
  62         content_url 
= content
.get('url') 
  64         content 
= self
._download
_xml
( 
  67             'Downloading media:content') 
  68         rendition_items 
= content
.findall('.//rendition') 
  69         duration 
= int(rendition_items
[0].get('duration')) 
  72                 'url': re
.sub(r
'.*/(r2)', RAW_MP4_URL 
+ r
'\1', r
.find('./src').text
), 
  73                 'width': int(r
.get('width')), 
  74                 'height': int(r
.get('height')), 
  75                 'tbr': int(r
.get('bitrate')), 
  77             for r 
in rendition_items
 
  79         self
._sort
_formats
(formats
) 
  84             'thumbnail': thumbnail
, 
  87             'description': description
, 
  88             'age_limit': age_limit
, 
  89             'timestamp': timestamp
,