[yourupload] Fix extraction (closes #11601)

This commit is contained in:
Sergey M․ 2017-01-15 10:34:39 +07:00
parent 6f0be93747
commit a7acf868a5
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -2,17 +2,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import urljoin
class YourUploadIE(InfoExtractor): class YourUploadIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)? _VALID_URL = r'https?://(?:www\.)?(?:yourupload\.com/(?:watch|embed)|embed\.yourupload\.com)/(?P<id>[A-Za-z0-9]+)'
(?:yourupload\.com/watch| _TESTS = [{
embed\.yourupload\.com|
embed\.yucache\.net
)/(?P<id>[A-Za-z0-9]+)
'''
_TESTS = [
{
'url': 'http://yourupload.com/watch/14i14h', 'url': 'http://yourupload.com/watch/14i14h',
'md5': '5e2c63385454c557f97c4c4131a393cd', 'md5': '5e2c63385454c557f97c4c4131a393cd',
'info_dict': { 'info_dict': {
@ -21,25 +16,23 @@ class YourUploadIE(InfoExtractor):
'title': 'BigBuckBunny_320x180.mp4', 'title': 'BigBuckBunny_320x180.mp4',
'thumbnail': r're:^https?://.*\.jpe?g', 'thumbnail': r're:^https?://.*\.jpe?g',
} }
}, }, {
{ 'url': 'http://www.yourupload.com/embed/14i14h',
'only_matching': True,
}, {
'url': 'http://embed.yourupload.com/14i14h', 'url': 'http://embed.yourupload.com/14i14h',
'only_matching': True, 'only_matching': True,
}, }]
{
'url': 'http://embed.yucache.net/14i14h?client_file_id=803349',
'only_matching': True,
},
]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
embed_url = 'http://embed.yucache.net/{0:}'.format(video_id) embed_url = 'http://www.yourupload.com/embed/%s' % video_id
webpage = self._download_webpage(embed_url, video_id) webpage = self._download_webpage(embed_url, video_id)
title = self._og_search_title(webpage) title = self._og_search_title(webpage)
video_url = self._og_search_video_url(webpage) video_url = urljoin(embed_url, self._og_search_video_url(webpage))
thumbnail = self._og_search_thumbnail(webpage, default=None) thumbnail = self._og_search_thumbnail(webpage, default=None)
return { return {