]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sharesix.py
ac3e3adf22ad194a8af3e833ae4d8acf7484e8b4
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  16 class ShareSixIE(InfoExtractor
): 
  17     _VALID_URL 
= r
'https?://(?:www\.)?sharesix\.com/(?:f/)?(?P<id>[0-9a-zA-Z]+)' 
  20             'url': 'http://sharesix.com/f/OXjQ7Y6', 
  21             'md5': '9e8e95d8823942815a7d7c773110cc93', 
  25                 'title': 'big_buck_bunny_480p_surround-fix.avi', 
  32             'url': 'http://sharesix.com/lfrwoxp35zdd', 
  33             'md5': 'dd19f1435b7cec2d7912c64beeee8185', 
  37                 'title': 'WhiteBoard___a_Mac_vs_PC_Parody_Cartoon.mp4.flv', 
  45     def _real_extract(self
, url
): 
  46         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  47         video_id 
= mobj
.group('id') 
  52         post 
= compat_urllib_parse
.urlencode(fields
) 
  53         req 
= compat_urllib_request
.Request(url
, post
) 
  54         req
.add_header('Content-type', 'application/x-www-form-urlencoded') 
  56         webpage 
= self
._download
_webpage
(req
, video_id
, 
  57                                          'Downloading video page') 
  59         video_url 
= self
._search
_regex
( 
  60             r
"var\slnk1\s=\s'([^']+)'", webpage
, 'video URL') 
  61         title 
= self
._html
_search
_regex
( 
  62             r
'(?s)<dt>Filename:</dt>.+?<dd>(.+?)</dd>', webpage
, 'title') 
  63         duration 
= parse_duration( 
  65                 r
'(?s)<dt>Length:</dt>.+?<dd>(.+?)</dd>', 
  73             r
'''(?xs)<dt>Width\sx\sHeight</dt>.+? 
  74                      <dd>(?P<width>\d+)\sx\s(?P<height>\d+)</dd>''', 
  79             width
, height 
= int(m
.group('width')), int(m
.group('height'))