]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/openfilm.py
2249657eb1b796970c155f4baf3445fef9b60681
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  14 class OpenFilmIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'http://(?:www\.)openfilm\.com/videos/(?P<id>.+)' 
  17         'url': 'http://www.openfilm.com/videos/human-resources-remastered', 
  18         'md5': '42bcd88c2f3ec13b65edf0f8ad1cac37', 
  21             'display_id': 'human-resources-remastered', 
  23             'title': 'Human Resources (Remastered)', 
  24             'description': 'Social Engineering in the 20th Century.', 
  25             'thumbnail': 're:^https?://.*\.jpg$', 
  27             'timestamp': 1334756988, 
  28             'upload_date': '20120418', 
  29             'uploader_id': '41117', 
  35     def _real_extract(self
, url
): 
  36         display_id 
= self
._match
_id
(url
) 
  38         webpage 
= self
._download
_webpage
(url
, display_id
) 
  40         player 
= compat_urllib_parse
.unquote_plus( 
  41             self
._og
_search
_video
_url
(webpage
)) 
  43         video 
= json
.loads(self
._search
_regex
( 
  44             r
'\bp=({.+?})(?:&|$)', player
, 'video JSON')) 
  46         video_url 
= '%s1.mp4' % video
['location'] 
  47         video_id 
= video
.get('video_id') 
  48         display_id 
= video
.get('alias') or display_id
 
  49         title 
= video
.get('title') 
  50         description 
= video
.get('description') 
  51         thumbnail 
= video
.get('main_thumb') 
  52         duration 
= int_or_none(video
.get('duration')) 
  53         timestamp 
= parse_iso8601(video
.get('dt_published'), ' ') 
  54         uploader_id 
= video
.get('user_id') 
  55         view_count 
= int_or_none(video
.get('views_count')) 
  56         age_limit 
= parse_age_limit(video
.get('age_limit')) 
  60             'display_id': display_id
, 
  63             'description': description
, 
  64             'thumbnail': thumbnail
, 
  66             'timestamp': timestamp
, 
  67             'uploader_id': uploader_id
, 
  68             'view_count': view_count
, 
  69             'age_limit': age_limit
,