1 from __future__ import unicode_literals
3 from .common import InfoExtractor
11 class PrimeShareTVIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?primeshare\.tv/download/(?P<id>[\da-zA-Z]+)'
15 'url': 'http://primeshare.tv/download/238790B611',
16 'md5': 'b92d9bf5461137c36228009f31533fbc',
20 'title': 'Public Domain - 1960s Commercial - Crest Toothpaste-YKsuFona',
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
27 webpage = self._download_webpage(url, video_id)
29 if '>File not exist<' in webpage:
30 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
32 fields = self._hidden_inputs(webpage)
36 'Content-Type': 'application/x-www-form-urlencoded',
39 wait_time = int(self._search_regex(
40 r'var\s+cWaitTime\s*=\s*(\d+)',
41 webpage, 'wait time', default=7)) + 1
42 self._sleep(wait_time, video_id)
44 req = sanitized_Request(
45 url, urlencode_postdata(fields), headers)
46 video_page = self._download_webpage(
47 req, video_id, 'Downloading video page')
49 video_url = self._search_regex(
50 r"url\s*:\s*'([^']+\.primeshare\.tv(?::443)?/file/[^']+)'",
51 video_page, 'video url')
53 title = self._html_search_regex(
54 r'<h1>Watch\s*(?: )?\s*\((.+?)(?:\s*\[\.\.\.\])?\)\s*(?: )?\s*<strong>',