2 from __future__ import unicode_literals
7 from .common import InfoExtractor
10 compat_urllib_request,
18 class MonikerIE(InfoExtractor):
19 IE_DESC = 'allmyvideos.net and vidspot.net'
20 _VALID_URL = r'https?://(?:www\.)?(?:allmyvideos|vidspot)\.net/(?P<id>[a-zA-Z0-9_-]+)'
23 'url': 'http://allmyvideos.net/jih3nce3x6wn',
24 'md5': '710883dee1bfc370ecf9fa6a89307c88',
28 'title': 'youtube-dl test video',
31 'url': 'http://allmyvideos.net/embed-jih3nce3x6wn',
32 'md5': '710883dee1bfc370ecf9fa6a89307c88',
36 'title': 'youtube-dl test video',
39 'url': 'http://vidspot.net/l2ngsmhs8ci5',
40 'md5': '710883dee1bfc370ecf9fa6a89307c88',
44 'title': 'youtube-dl test video',
47 'url': 'https://www.vidspot.net/l2ngsmhs8ci5',
48 'only_matching': True,
51 def _real_extract(self, url):
52 orig_video_id = self._match_id(url)
53 video_id = remove_start(orig_video_id, 'embed-')
54 url = url.replace(orig_video_id, video_id)
55 assert re.match(self._VALID_URL, url) is not None
56 orig_webpage = self._download_webpage(url, video_id)
58 if '>File Not Found<' in orig_webpage:
59 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
61 error = self._search_regex(
62 r'class="err">([^<]+)<', orig_webpage, 'error', default=None)
65 '%s returned error: %s' % (self.IE_NAME, error), expected=True)
67 fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
70 post = compat_urllib_parse.urlencode(data)
72 b'Content-Type': b'application/x-www-form-urlencoded',
74 req = compat_urllib_request.Request(url, post, headers)
75 webpage = self._download_webpage(
76 req, video_id, note='Downloading video page ...')
78 title = os.path.splitext(data['fname'])[0]
80 # Could be several links with different quality
81 links = re.findall(r'"file" : "?(.+?)",', webpage)
82 # Assume the links are ordered in quality
86 } for i, l in enumerate(links)]
87 self._sort_formats(formats)