]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/openload.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_chr
12 class OpenloadIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:openload\.(?:co|io)|oload\.tv)/(?:f|embed)/(?P<id>[a-zA-Z0-9-_]+)'
16 'url': 'https://openload.co/f/kUEfGclsU9o',
17 'md5': 'bf1c059b004ebc7a256f89408e65c36e',
21 'title': 'skyrim_no-audio_1080.mp4',
22 'thumbnail': 're:^https?://.*\.jpg$',
25 'url': 'https://openload.co/embed/rjC09fkPLYs',
30 'thumbnail': 're:^https?://.*\.jpg$',
38 'skip_download': True, # test subtitles only
41 'url': 'https://openload.co/embed/kUEfGclsU9o/skyrim_no-audio_1080.mp4',
42 'only_matching': True,
44 'url': 'https://openload.io/f/ZAn6oz-VZGE/',
45 'only_matching': True,
47 'url': 'https://openload.co/f/_-ztPaZtMhM/',
48 'only_matching': True,
50 # unavailable via https://openload.co/f/Sxz5sADo82g/, different layout
52 'url': 'https://openload.co/embed/Sxz5sADo82g/',
53 'only_matching': True,
55 'url': 'https://oload.tv/embed/KnG-kKZdcfY/',
56 'only_matching': True,
59 def _real_extract(self
, url
):
60 video_id
= self
._match
_id
(url
)
61 webpage
= self
._download
_webpage
('https://openload.co/embed/%s/' % video_id
, video_id
)
63 if 'File not found' in webpage
or 'deleted by the owner' in webpage
:
64 raise ExtractorError('File not found', expected
=True)
66 ol_id
= self
._search
_regex
(
67 '<span[^>]+id="[a-zA-Z0-9]+x"[^>]*>([0-9]+)</span>',
68 webpage
, 'openload ID')
70 first_two_chars
= int(float(ol_id
[0:][:2]))
74 while num
< len(ol_id
):
75 urlcode
+= compat_chr(int(float(ol_id
[num
:][:3])) -
76 first_two_chars
* int(float(ol_id
[num
+ 3:][:2])))
79 video_url
= 'https://openload.co/stream/' + urlcode
81 title
= self
._og
_search
_title
(webpage
, default
=None) or self
._search
_regex
(
82 r
'<span[^>]+class=["\']title
["\'][^>]*>([^<]+)', webpage,
83 'title', default=None) or self._html_search_meta(
84 'description', webpage, 'title', fatal=True)
86 entries = self._parse_html5_media_entries(url, webpage, video_id)
87 subtitles = entries[0]['subtitles'] if entries else None
92 'thumbnail': self._og_search_thumbnail(webpage, default=None),
94 # Seems all videos have extensions in their titles
95 'ext': determine_ext(title),
96 'subtitles': subtitles,