]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/openload.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_chr
14 class OpenloadIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:openload\.(?:co|io)|oload\.tv)/(?:f|embed)/(?P<id>[a-zA-Z0-9-_]+)'
18 'url': 'https://openload.co/f/kUEfGclsU9o',
19 'md5': 'bf1c059b004ebc7a256f89408e65c36e',
23 'title': 'skyrim_no-audio_1080.mp4',
24 'thumbnail': r
're:^https?://.*\.jpg$',
27 'url': 'https://openload.co/embed/rjC09fkPLYs',
32 'thumbnail': r
're:^https?://.*\.jpg$',
40 'skip_download': True, # test subtitles only
43 'url': 'https://openload.co/embed/kUEfGclsU9o/skyrim_no-audio_1080.mp4',
44 'only_matching': True,
46 'url': 'https://openload.io/f/ZAn6oz-VZGE/',
47 'only_matching': True,
49 'url': 'https://openload.co/f/_-ztPaZtMhM/',
50 'only_matching': True,
52 # unavailable via https://openload.co/f/Sxz5sADo82g/, different layout
54 'url': 'https://openload.co/embed/Sxz5sADo82g/',
55 'only_matching': True,
57 'url': 'https://oload.tv/embed/KnG-kKZdcfY/',
58 'only_matching': True,
62 def _extract_urls(webpage
):
64 r
'<iframe[^>]+src=["\']((?
:https?
://)?
(?
:openload\
.(?
:co|io
)|oload\
.tv
)/embed
/[a
-zA
-Z0
-9-_
]+)',
67 def _real_extract(self, url):
68 video_id = self._match_id(url)
69 webpage = self._download_webpage('https
://openload
.co
/embed
/%s/' % video_id, video_id)
71 if 'File
not found
' in webpage or 'deleted by the owner
' in webpage:
72 raise ExtractorError('File
not found
', expected=True)
74 ol_id = self._search_regex(
75 '<span
[^
>]+id="[^"]+"[^>]*>([0-9]+)</span>',
76 webpage, 'openload ID')
78 first_three_chars = int(float(ol_id[0:][:3]))
79 fifth_char = int(float(ol_id[3:5]))
83 while num < len(ol_id):
84 urlcode += compat_chr(int(float(ol_id[num:][:3])) +
85 first_three_chars - fifth_char * int(float(ol_id[num + 3:][:2])))
88 video_url = 'https://openload.co/stream/' + urlcode
90 title = self._og_search_title(webpage, default=None) or self._search_regex(
91 r'<span[^>]+class=["\']title
["\'][^>]*>([^<]+)', webpage,
92 'title', default=None) or self._html_search_meta(
93 'description', webpage, 'title', fatal=True)
95 entries = self._parse_html5_media_entries(url, webpage, video_id)
96 subtitles = entries[0]['subtitles'] if entries else None
101 'thumbnail': self._og_search_thumbnail(webpage, default=None),
103 # Seems all videos have extensions in their titles
104 'ext': determine_ext(title, 'mp4'),
105 'subtitles': subtitles,