]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/expotv.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  12 class ExpoTVIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://www\.expotv\.com/videos/[^?#]*/(?P<id>[0-9]+)($|[?#])' 
  15         'url': 'http://www.expotv.com/videos/reviews/1/24/LinneCardscom/17561', 
  16         'md5': '2985e6d7a392b2f7a05e0ca350fe41d0', 
  20             'upload_date': '20060212', 
  21             'title': 'My Favorite Online Scrapbook Store', 
  23             'description': 'You\'ll find most everything you need at this virtual store front.', 
  24             'uploader': 'Anna T.', 
  25             'thumbnail': 're:^https?://.*\.jpg$', 
  29     def _real_extract(self
, url
): 
  30         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  31         video_id 
= mobj
.group('id') 
  33         webpage 
= self
._download
_webpage
(url
, video_id
) 
  34         player_key 
= self
._search
_regex
( 
  35             r
'<param name="playerKey" value="([^"]+)"', webpage
, 'player key') 
  36         config_url 
= 'http://client.expotv.com/video/config/%s/%s' % ( 
  38         config 
= self
._download
_json
( 
  40             note
='Downloading video configuration') 
  44             'height': int_or_none(fcfg
.get('height')), 
  45             'format_note': fcfg
.get('label'), 
  46             'ext': self
._search
_regex
( 
  47                 r
'filename=.*\.([a-z0-9_A-Z]+)&', fcfg
['file'], 
  48                 'file extension', default
=None), 
  49         } for fcfg 
in config
['sources']] 
  50         self
._sort
_formats
(formats
) 
  52         title 
= self
._og
_search
_title
(webpage
) 
  53         description 
= self
._og
_search
_description
(webpage
) 
  54         thumbnail 
= config
.get('image') 
  55         view_count 
= int_or_none(self
._search
_regex
( 
  56             r
'<h5>Plays: ([0-9]+)</h5>', webpage
, 'view counts')) 
  57         uploader 
= self
._search
_regex
( 
  58             r
'<div class="reviewer">\s*<img alt="([^"]+)"', webpage
, 'uploader', 
  60         upload_date 
= unified_strdate(self
._search
_regex
( 
  61             r
'<h5>Reviewed on ([0-9/.]+)</h5>', webpage
, 'upload date', 
  68             'description': description
, 
  69             'view_count': view_count
, 
  70             'thumbnail': thumbnail
, 
  72             'upload_date': upload_date
,