]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/yourupload.py
debian/{compat,control}: Relutanctly update compat to 11.
[youtubedl] / youtube_dl / extractor / yourupload.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import urljoin
6
7
8 class YourUploadIE(InfoExtractor):
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 }]
26
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29
30 embed_url = 'http://www.yourupload.com/embed/%s' % video_id
31
32 webpage = self._download_webpage(embed_url, video_id)
33
34 title = self._og_search_title(webpage)
35 video_url = urljoin(embed_url, self._og_search_video_url(webpage))
36 thumbnail = self._og_search_thumbnail(webpage, default=None)
37
38 return {
39 'id': video_id,
40 'title': title,
41 'url': video_url,
42 'thumbnail': thumbnail,
43 'http_headers': {
44 'Referer': embed_url,
45 },
46 }