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/(?:(?:2|v)/v-)?(?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,
50 'url': 'http://vidspot.net/2/v-ywDf99',
51 'md5': '5f8254ce12df30479428b0152fb8e7ba',
55 'title': 'IL FAIT LE MALIN EN PORSHE CAYENNE ( mais pas pour longtemps)',
56 'description': 'IL FAIT LE MALIN EN PORSHE CAYENNE.',
59 'url': 'http://allmyvideos.net/v/v-HXZm5t',
60 'only_matching': True,
63 def _real_extract(self, url):
64 orig_video_id = self._match_id(url)
65 video_id = remove_start(orig_video_id, 'embed-')
66 url = url.replace(orig_video_id, video_id)
67 assert re.match(self._VALID_URL, url) is not None
68 orig_webpage = self._download_webpage(url, video_id)
70 if '>File Not Found<' in orig_webpage:
71 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
73 error = self._search_regex(
74 r'class="err">([^<]+)<', orig_webpage, 'error', default=None)
77 '%s returned error: %s' % (self.IE_NAME, error), expected=True)
79 builtin_url = self._search_regex(
80 r'<iframe[^>]+src=(["\'])(?P<url>.+?/builtin-.+?)\1',
81 orig_webpage, 'builtin URL', default=None, group='url')
84 req = compat_urllib_request.Request(builtin_url)
85 req.add_header('Referer', url)
86 webpage = self._download_webpage(req, video_id, 'Downloading builtin page')
87 title = self._og_search_title(orig_webpage).strip()
88 description = self._og_search_description(orig_webpage).strip()
90 fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
93 post = compat_urllib_parse.urlencode(data)
95 b'Content-Type': b'application/x-www-form-urlencoded',
97 req = compat_urllib_request.Request(url, post, headers)
98 webpage = self._download_webpage(
99 req, video_id, note='Downloading video page ...')
101 title = os.path.splitext(data['fname'])[0]
104 # Could be several links with different quality
105 links = re.findall(r'"file" : "?(.+?)",', webpage)
106 # Assume the links are ordered in quality
110 } for i, l in enumerate(links)]
111 self._sort_formats(formats)
116 'description': description,