]>
Commit | Line | Data |
---|---|---|
b28c8403 NJ |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
b28c8403 | 4 | from .common import InfoExtractor |
a7acf868 | 5 | from ..utils import urljoin |
b28c8403 NJ |
6 | |
7 | ||
8 | class YourUploadIE(InfoExtractor): | |
a7acf868 S |
9 | _VALID_URL = r'https?://(?:www\.)?(?:yourupload\.com/(?:watch|embed)|embed\.yourupload\.com)/(?P<id>[A-Za-z0-9]+)' |
10 | _TESTS = [{ | |
11 | 'url': 'http://yourupload.com/watch/14i14h', | |
12 | 'md5': '5e2c63385454c557f97c4c4131a393cd', | |
13 | 'info_dict': { | |
14 | 'id': '14i14h', | |
15 | 'ext': 'mp4', | |
16 | 'title': 'BigBuckBunny_320x180.mp4', | |
17 | 'thumbnail': r're:^https?://.*\.jpe?g', | |
18 | } | |
19 | }, { | |
20 | 'url': 'http://www.yourupload.com/embed/14i14h', | |
21 | 'only_matching': True, | |
22 | }, { | |
23 | 'url': 'http://embed.yourupload.com/14i14h', | |
24 | 'only_matching': True, | |
25 | }] | |
b28c8403 NJ |
26 | |
27 | def _real_extract(self, url): | |
cbbece96 | 28 | video_id = self._match_id(url) |
b28c8403 | 29 | |
a7acf868 S |
30 | embed_url = 'http://www.yourupload.com/embed/%s' % video_id |
31 | ||
9d8ba307 | 32 | webpage = self._download_webpage(embed_url, video_id) |
b28c8403 NJ |
33 | |
34 | title = self._og_search_title(webpage) | |
a7acf868 | 35 | video_url = urljoin(embed_url, self._og_search_video_url(webpage)) |
cbbece96 | 36 | thumbnail = self._og_search_thumbnail(webpage, default=None) |
b28c8403 NJ |
37 | |
38 | return { | |
39 | 'id': video_id, | |
40 | 'title': title, | |
cbbece96 | 41 | 'url': video_url, |
b28c8403 | 42 | 'thumbnail': thumbnail, |
9d8ba307 YCH |
43 | 'http_headers': { |
44 | 'Referer': embed_url, | |
45 | }, | |
b28c8403 | 46 | } |