]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/roxwel.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import unified_strdate
, determine_ext
 
   9 class RoxwelIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:www\.)?roxwel\.com/player/(?P<filename>.+?)(\.|\?|$)' 
  13         'url': 'http://www.roxwel.com/player/passionpittakeawalklive.html', 
  15             'id': 'passionpittakeawalklive', 
  17             'title': 'Take A Walk (live)', 
  18             'uploader': 'Passion Pit', 
  19             'uploader_id': 'passionpit', 
  20             'upload_date': '20120928', 
  21             'description': 'Passion Pit performs "Take A Walk\" live at The Backyard in Austin, Texas. ', 
  25             'skip_download': True, 
  29     def _real_extract(self
, url
): 
  30         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  31         filename 
= mobj
.group('filename') 
  32         info_url 
= 'http://www.roxwel.com/api/videos/%s' % filename
 
  33         info 
= self
._download
_json
(info_url
, filename
) 
  35         rtmp_rates 
= sorted([int(r
.replace('flv_', '')) for r 
in info
['media_rates'] if r
.startswith('flv_')]) 
  36         best_rate 
= rtmp_rates
[-1] 
  37         url_page_url 
= 'http://roxwel.com/pl_one_time.php?filename=%s&quality=%s' % (filename
, best_rate
) 
  38         rtmp_url 
= self
._download
_webpage
(url_page_url
, filename
, 'Downloading video url') 
  39         ext 
= determine_ext(rtmp_url
) 
  41             rtmp_url 
= rtmp_url
.replace(filename
, 'mp4:%s' % filename
) 
  45             'title': info
['title'], 
  48             'description': info
['description'], 
  49             'thumbnail': info
.get('player_image_url') or info
.get('image_url_large'), 
  50             'uploader': info
['artist'], 
  51             'uploader_id': info
['artistname'], 
  52             'upload_date': unified_strdate(info
['dbdate']),