]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sharesix.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_parse
14 class ShareSixIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?sharesix\.com/(?:f/)?(?P<id>[0-9a-zA-Z]+)'
18 'url': 'http://sharesix.com/f/OXjQ7Y6',
19 'md5': '9e8e95d8823942815a7d7c773110cc93',
23 'title': 'big_buck_bunny_480p_surround-fix.avi',
30 'url': 'http://sharesix.com/lfrwoxp35zdd',
31 'md5': 'dd19f1435b7cec2d7912c64beeee8185',
35 'title': 'WhiteBoard___a_Mac_vs_PC_Parody_Cartoon.mp4.flv',
43 def _real_extract(self
, url
):
44 mobj
= re
.match(self
._VALID
_URL
, url
)
45 video_id
= mobj
.group('id')
50 post
= compat_urllib_parse
.urlencode(fields
)
51 req
= sanitized_Request(url
, post
)
52 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
54 webpage
= self
._download
_webpage
(req
, video_id
,
55 'Downloading video page')
57 video_url
= self
._search
_regex
(
58 r
"var\slnk1\s=\s'([^']+)'", webpage
, 'video URL')
59 title
= self
._html
_search
_regex
(
60 r
'(?s)<dt>Filename:</dt>.+?<dd>(.+?)</dd>', webpage
, 'title')
61 duration
= parse_duration(
63 r
'(?s)<dt>Length:</dt>.+?<dd>(.+?)</dd>',
71 r
'''(?xs)<dt>Width\sx\sHeight</dt>.+?
72 <dd>(?P<width>\d+)\sx\s(?P<height>\d+)</dd>''',
77 width
, height
= int(m
.group('width')), int(m
.group('height'))