]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/criterion.py
   1 # -*- coding: utf-8 -*- 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import determine_ext
 
   8 class CriterionIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://www\.criterion\.com/films/(\d*)-.+' 
  11         u
'url': u
'http://www.criterion.com/films/184-le-samourai', 
  13         u
'md5': u
'bc51beba55685509883a9a7830919ec3', 
  15             u
"title": u
"Le Samouraï", 
  16             u
"description" : u
'md5:a2b4b116326558149bef81f76dcbb93f', 
  20     def _real_extract(self
, url
): 
  21         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  22         video_id 
= mobj
.group(1) 
  23         webpage 
= self
._download
_webpage
(url
, video_id
) 
  25         final_url 
= self
._search
_regex
(r
'so.addVariable\("videoURL", "(.+?)"\)\;', 
  27         title 
= self
._html
_search
_regex
(r
'<meta content="(.+?)" property="og:title" />', 
  28                                 webpage
, 'video title') 
  29         description 
= self
._html
_search
_regex
(r
'<meta name="description" content="(.+?)" />', 
  30                                 webpage
, 'video description') 
  31         thumbnail 
= self
._search
_regex
(r
'so.addVariable\("thumbnailURL", "(.+?)"\)\;', 
  32                                 webpage
, 'thumbnail url') 
  34         return {'id': video_id
, 
  37                 'ext': determine_ext(final_url
), 
  38                 'description': description
, 
  39                 'thumbnail': thumbnail
,