1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 00:54:31 +01:00

[moniker] Add support for builtin embedded videos (Closes #7244)

This commit is contained in:
Sergey M․ 2015-10-29 22:44:01 +06:00
parent 03c2c162f9
commit 6fb8ace671

View File

@ -17,7 +17,7 @@ from ..utils import (
class MonikerIE(InfoExtractor): class MonikerIE(InfoExtractor):
IE_DESC = 'allmyvideos.net and vidspot.net' IE_DESC = 'allmyvideos.net and vidspot.net'
_VALID_URL = r'https?://(?:www\.)?(?:allmyvideos|vidspot)\.net/(?P<id>[a-zA-Z0-9_-]+)' _VALID_URL = r'https?://(?:www\.)?(?:allmyvideos|vidspot)\.net/(?:(?:2|v)/v-)?(?P<id>[a-zA-Z0-9_-]+)'
_TESTS = [{ _TESTS = [{
'url': 'http://allmyvideos.net/jih3nce3x6wn', 'url': 'http://allmyvideos.net/jih3nce3x6wn',
@ -64,18 +64,30 @@ class MonikerIE(InfoExtractor):
raise ExtractorError( raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, error), expected=True) '%s returned error: %s' % (self.IE_NAME, error), expected=True)
fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage) builtin_url = self._search_regex(
data = dict(fields) r'<iframe[^>]+src=(["\'])(?P<url>.+?/builtin-.+?)\1',
orig_webpage, 'builtin URL', default=None, group='url')
post = compat_urllib_parse.urlencode(data) if builtin_url:
headers = { req = compat_urllib_request.Request(builtin_url)
b'Content-Type': b'application/x-www-form-urlencoded', req.add_header('Referer', url)
} webpage = self._download_webpage(req, video_id, 'Downloading builtin page')
req = compat_urllib_request.Request(url, post, headers) title = self._og_search_title(orig_webpage).strip()
webpage = self._download_webpage( description = self._og_search_description(orig_webpage).strip()
req, video_id, note='Downloading video page ...') else:
fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
data = dict(fields)
title = os.path.splitext(data['fname'])[0] post = compat_urllib_parse.urlencode(data)
headers = {
b'Content-Type': b'application/x-www-form-urlencoded',
}
req = compat_urllib_request.Request(url, post, headers)
webpage = self._download_webpage(
req, video_id, note='Downloading video page ...')
title = os.path.splitext(data['fname'])[0]
description = None
# Could be several links with different quality # Could be several links with different quality
links = re.findall(r'"file" : "?(.+?)",', webpage) links = re.findall(r'"file" : "?(.+?)",', webpage)
@ -89,5 +101,6 @@ class MonikerIE(InfoExtractor):
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'description': description,
'formats': formats, 'formats': formats,
} }