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