]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/primesharetv.py
01cc3d9ea3ff845476a7f7b306c3bfee25078b96
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
10 from ..utils
import ExtractorError
13 class PrimeShareTVIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?primeshare\.tv/download/(?P<id>[\da-zA-Z]+)'
17 'url': 'http://primeshare.tv/download/238790B611',
18 'md5': 'b92d9bf5461137c36228009f31533fbc',
22 'title': 'Public Domain - 1960s Commercial - Crest Toothpaste-YKsuFona',
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 if '>File not exist<' in webpage
:
32 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
34 fields
= dict(re
.findall(r
'''(?x)<input\s+
43 'Content-Type': 'application/x-www-form-urlencoded',
46 wait_time
= int(self
._search
_regex
(
47 r
'var\s+cWaitTime\s*=\s*(\d+)',
48 webpage
, 'wait time', default
=7)) + 1
49 self
._sleep
(wait_time
, video_id
)
51 req
= compat_urllib_request
.Request(
52 url
, compat_urllib_parse
.urlencode(fields
), headers
)
53 video_page
= self
._download
_webpage
(
54 req
, video_id
, 'Downloading video page')
56 video_url
= self
._search
_regex
(
57 r
"url\s*:\s*'([^']+\.primeshare\.tv(?::443)?/file/[^']+)'",
58 video_page
, 'video url')
60 title
= self
._html
_search
_regex
(
61 r
'<h1>Watch\s*(?: )?\s*\((.+?)(?:\s*\[\.\.\.\])?\)\s*(?: )?\s*<strong>',