2 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..compat import compat_urllib_parse
16 class MonikerIE(InfoExtractor):
17 IE_DESC = 'allmyvideos.net and vidspot.net'
18 _VALID_URL = r'https?://(?:www\.)?(?:allmyvideos|vidspot)\.net/(?:(?:2|v)/v-)?(?P<id>[a-zA-Z0-9_-]+)'
21 'url': 'http://allmyvideos.net/jih3nce3x6wn',
22 'md5': '710883dee1bfc370ecf9fa6a89307c88',
26 'title': 'youtube-dl test video',
29 'url': 'http://allmyvideos.net/embed-jih3nce3x6wn',
30 'md5': '710883dee1bfc370ecf9fa6a89307c88',
34 'title': 'youtube-dl test video',
37 'url': 'http://vidspot.net/l2ngsmhs8ci5',
38 'md5': '710883dee1bfc370ecf9fa6a89307c88',
42 'title': 'youtube-dl test video',
45 'url': 'https://www.vidspot.net/l2ngsmhs8ci5',
46 'only_matching': True,
48 'url': 'http://vidspot.net/2/v-ywDf99',
49 'md5': '5f8254ce12df30479428b0152fb8e7ba',
53 'title': 'IL FAIT LE MALIN EN PORSHE CAYENNE ( mais pas pour longtemps)',
54 'description': 'IL FAIT LE MALIN EN PORSHE CAYENNE.',
57 'url': 'http://allmyvideos.net/v/v-HXZm5t',
58 'only_matching': True,
61 def _real_extract(self, url):
62 orig_video_id = self._match_id(url)
63 video_id = remove_start(orig_video_id, 'embed-')
64 url = url.replace(orig_video_id, video_id)
65 assert re.match(self._VALID_URL, url) is not None
66 orig_webpage = self._download_webpage(url, video_id)
68 if '>File Not Found<' in orig_webpage:
69 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
71 error = self._search_regex(
72 r'class="err">([^<]+)<', orig_webpage, 'error', default=None)
75 '%s returned error: %s' % (self.IE_NAME, error), expected=True)
77 builtin_url = self._search_regex(
78 r'<iframe[^>]+src=(["\'])(?P<url>.+?/builtin-.+?)\1',
79 orig_webpage, 'builtin URL', default=None, group='url')
82 req = sanitized_Request(builtin_url)
83 req.add_header('Referer', url)
84 webpage = self._download_webpage(req, video_id, 'Downloading builtin page')
85 title = self._og_search_title(orig_webpage).strip()
86 description = self._og_search_description(orig_webpage).strip()
88 fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
91 post = compat_urllib_parse.urlencode(data)
93 b'Content-Type': b'application/x-www-form-urlencoded',
95 req = sanitized_Request(url, post, headers)
96 webpage = self._download_webpage(
97 req, video_id, note='Downloading video page ...')
99 title = os.path.splitext(data['fname'])[0]
102 # Could be several links with different quality
103 links = re.findall(r'"file" : "?(.+?)",', webpage)
104 # Assume the links are ordered in quality
108 } for i, l in enumerate(links)]
109 self._sort_formats(formats)
114 'description': description,