]>
jfr.im git - yt-dlp.git/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)/(?: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': 're:^https?://.*\.jpg$',
27 'url': 'https://openload.co/embed/kUEfGclsU9o/skyrim_no-audio_1080.mp4',
28 'only_matching': True,
30 'url': 'https://openload.io/f/ZAn6oz-VZGE/',
31 'only_matching': True,
35 def openload_level2_debase(m
):
36 radix
, num
= int(m
.group(1)) + 27, int(m
.group(2))
37 return '"' + encode_base_n(num
, radix
) + '"'
40 def openload_level2(cls
, txt
):
41 # The function name is ǃ \u01c3
42 # Using escaped unicode literals does not work in Python 3.2
43 return re
.sub(r
'ǃ\((\d+),(\d+)\)', cls
.openload_level2_debase
, txt
, re
.UNICODE
).replace('"+"', '')
45 # Openload uses a variant of aadecode
46 # openload_decode and related functions are originally written by
47 # vitas@matfyz.cz and released with public domain
48 # See https://github.com/rg3/youtube-dl/issues/8489
50 def openload_decode(cls
, txt
):
53 ('a', '(゚Д゚) [゚ω゚ノ]'),
54 ('b', '(゚Д゚) [゚Θ゚ノ]'),
55 ('c', '(゚Д゚) [\'c\']'),
56 ('d', '(゚Д゚) [゚ー゚ノ]'),
57 ('e', '(゚Д゚) [゚Д゚ノ]'),
60 ('o', '(゚Д゚) [\'o\']'),
62 ('c', '(゚Д゚) [\'c\']'),
64 ('7', '((゚ー゚) + (o^_^o))'),
65 ('6', '((o^_^o) +(o^_^o) +(c^_^o))'),
66 ('5', '((゚ー゚) + (゚Θ゚))'),
71 ('0', '((c^_^o)-(c^_^o))'),
75 for aachar
in txt
.split(delim
):
76 for val
, pat
in symbol_table
:
77 aachar
= aachar
.replace(pat
, val
)
78 aachar
= aachar
.replace('+ ', '')
79 m
= re
.match(r
'^\d+', aachar
)
81 ret
+= compat_chr(int(m
.group(0), 8))
83 m
= re
.match(r
'^u([\da-f]+)', aachar
)
85 ret
+= compat_chr(int(m
.group(1), 16))
86 return cls
.openload_level2(ret
)
88 def _real_extract(self
, url
):
89 video_id
= self
._match
_id
(url
)
90 webpage
= self
._download
_webpage
(url
, video_id
)
92 if 'File not found' in webpage
:
93 raise ExtractorError('File not found', expected
=True)
95 code
= self
._search
_regex
(
96 r
'<video[^>]+>\s*<script[^>]+>([^<]+)</script>',
99 video_url
= self
._search
_regex
(
100 r
'return\s+"(https?://[^"]+)"', self
.openload_decode(code
), 'video URL')
104 'title': self
._og
_search
_title
(webpage
),
105 'thumbnail': self
._og
_search
_thumbnail
(webpage
),