|
@@ -1,777 +0,0 @@
|
1
|
|
-# -*- coding: UTF-8 -*-
|
2
|
|
-# /*
|
3
|
|
-# * Copyright (C) 2015 Lubomir Kucera
|
4
|
|
-# *
|
5
|
|
-# *
|
6
|
|
-# * This Program is free software; you can redistribute it and/or modify
|
7
|
|
-# * it under the terms of the GNU General Public License as published by
|
8
|
|
-# * the Free Software Foundation; either version 2, or (at your option)
|
9
|
|
-# * any later version.
|
10
|
|
-# *
|
11
|
|
-# * This Program is distributed in the hope that it will be useful,
|
12
|
|
-# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
|
-# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
|
-# * GNU General Public License for more details.
|
15
|
|
-# *
|
16
|
|
-# * You should have received a copy of the GNU General Public License
|
17
|
|
-# * along with this program; see the file COPYING. If not, write to
|
18
|
|
-# * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
19
|
|
-# * http://www.gnu.org/copyleft/gpl.html
|
20
|
|
-# *
|
21
|
|
-# */
|
22
|
|
-
|
23
|
|
-import re,os,sys
|
24
|
|
-try:
|
25
|
|
- import util
|
26
|
|
-except:
|
27
|
|
- pp = os.path.dirname(os.path.abspath(__file__))
|
28
|
|
- sys.path.insert(0,os.sep.join(pp.split(os.sep)[:-1]))
|
29
|
|
- import util
|
30
|
|
-import urllib2
|
31
|
|
-from aadecode import AADecoder
|
32
|
|
-
|
33
|
|
-__author__ = 'Jose Riha/Lubomir Kucera'
|
34
|
|
-__name__ = 'openload2'
|
35
|
|
-
|
36
|
|
-
|
37
|
|
-def supports(url):
|
38
|
|
- #return re.search(r'openload\.\w+/embed/.+', url) is not None
|
39
|
|
- return False
|
40
|
|
-
|
41
|
|
-
|
42
|
|
-# uses code fragments from https://github.com/LordVenom/venom-xbmc-addons
|
43
|
|
-def resolve(url):
|
44
|
|
- stream = util.item()
|
45
|
|
- stream["url"]=get_media_url(url)
|
46
|
|
-
|
47
|
|
- ### Retrieve subtitles ####
|
48
|
|
- HTTP_HEADER = {
|
49
|
|
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
|
50
|
|
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
51
|
|
- 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
52
|
|
- 'Accept-Encoding': 'none',
|
53
|
|
- 'Accept-Language': 'en-US,en;q=0.8',
|
54
|
|
- 'Referer': url} # 'Connection': 'keep-alive'
|
55
|
|
- html = requests.get(url, headers=HTTP_HEADER).content
|
56
|
|
- m = re.search('<track kind="captions" src="([^"]+)" srclang="([^"]+)" label="([^"]+)"', html)
|
57
|
|
- if m:
|
58
|
|
- stream["subs"] = m.group(1)
|
59
|
|
- stream["lang"] = m.group(2)
|
60
|
|
-
|
61
|
|
- return [stream]
|
62
|
|
-
|
63
|
|
-
|
64
|
|
-txt = """
|
65
|
|
-openload.io urlresolver plugin
|
66
|
|
-Copyright (C) 2015 tknorris
|
67
|
|
-
|
68
|
|
-This program is free software: you can redistribute it and/or modify
|
69
|
|
-it under the terms of the GNU General Public License as published by
|
70
|
|
-the Free Software Foundation, either version 3 of the License, or
|
71
|
|
-(at your option) any later version.
|
72
|
|
-
|
73
|
|
-This program is distributed in the hope that it will be useful,
|
74
|
|
-but WITHOUT ANY WARRANTY; without even the implied warranty of
|
75
|
|
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
76
|
|
-GNU General Public License for more details.
|
77
|
|
-
|
78
|
|
-You should have received a copy of the GNU General Public License
|
79
|
|
-along with this program. If not, see <http://www.gnu.org/licenses/>.
|
80
|
|
-"""
|
81
|
|
-import urllib
|
82
|
|
-import re
|
83
|
|
-import urllib2
|
84
|
|
-from HTMLParser import HTMLParser
|
85
|
|
-import requests
|
86
|
|
-#from lib.net import Net
|
87
|
|
-#from urlresolver import common
|
88
|
|
-#from urlresolver.resolver import ResolverError
|
89
|
|
-
|
90
|
|
-#net = Net() #III
|
91
|
|
-SIZE_LIMIT = 32 * 1024 * 1024
|
92
|
|
-
|
93
|
|
-def caesar_shift(s, shift=13):
|
94
|
|
- s2 = ''
|
95
|
|
- for c in s:
|
96
|
|
- if c.isalpha():
|
97
|
|
- limit = 90 if c <= 'Z' else 122
|
98
|
|
- new_code = ord(c) + shift
|
99
|
|
- if new_code > limit:
|
100
|
|
- new_code -= 26
|
101
|
|
- s2 += chr(new_code)
|
102
|
|
- else:
|
103
|
|
- s2 += c
|
104
|
|
- return s2
|
105
|
|
-
|
106
|
|
-def unpack(html):
|
107
|
|
- strings = re.findall('{\s*var\s+a\s*=\s*"([^"]+)', html)
|
108
|
|
- shifts = re.findall('\)\);}\((\d+)\)', html)
|
109
|
|
- for s, shift in zip(strings, shifts):
|
110
|
|
- s = caesar_shift(s, int(shift))
|
111
|
|
- s = urllib.unquote(s)
|
112
|
|
- for i, replace in enumerate(['j', '_', '__', '___']):
|
113
|
|
- s = s.replace(str(i), replace)
|
114
|
|
- html += '<script>%s</script>' % (s)
|
115
|
|
- return html
|
116
|
|
-
|
117
|
|
-def get_media_url(url):
|
118
|
|
- HTTP_HEADER = {
|
119
|
|
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
|
120
|
|
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
121
|
|
- 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
122
|
|
- 'Accept-Encoding': 'none',
|
123
|
|
- 'Accept-Language': 'en-US,en;q=0.8',
|
124
|
|
- 'Referer': url} # 'Connection': 'keep-alive'
|
125
|
|
-
|
126
|
|
- #html = net.http_GET(url, headers=HTTP_HEADER).content
|
127
|
|
- html = requests.get(url, headers=HTTP_HEADER).content
|
128
|
|
-
|
129
|
|
- try: html = html.encode('utf-8')
|
130
|
|
- except: pass
|
131
|
|
- html = unpack(html)
|
132
|
|
- #match = re.search('''>([^<]+)</span>\s*<span\s+id="streamurl"''', html, re.DOTALL | re.IGNORECASE)
|
133
|
|
- match = re.search(r'<span[^>]*>([^<]+)</span>\s*<span[^>]*>[^<]+</span>\s*<span[^>]+id="streamurl"', html, re.DOTALL | re.IGNORECASE)
|
134
|
|
- if not match:
|
135
|
|
- raise Exception('Stream Url Not Found. Deleted?')
|
136
|
|
-
|
137
|
|
- hiddenurl = HTMLParser().unescape(match.group(1))
|
138
|
|
-
|
139
|
|
- decodes = []
|
140
|
|
- for match in re.finditer('<script[^>]*>(.*?)</script>', html, re.DOTALL):
|
141
|
|
- encoded = match.group(1)
|
142
|
|
- match = re.search("(゚ω゚ノ.*?\('_'\);)", encoded, re.DOTALL)
|
143
|
|
- if match:
|
144
|
|
- decodes.append(AADecoder(match.group(1)).decode())
|
145
|
|
-
|
146
|
|
- match = re.search('(.=~\[\].*\(\);)', encoded, re.DOTALL)
|
147
|
|
- if match:
|
148
|
|
- decodes.append(JJDecoder(match.group(1)).decode())
|
149
|
|
-
|
150
|
|
- if not decodes:
|
151
|
|
- raise Exception('No Encoded Section Found. Deleted?')
|
152
|
|
-
|
153
|
|
- magic_number = 0
|
154
|
|
- for decode in decodes:
|
155
|
|
- match = re.search('charCodeAt\(\d+\)\s*\+\s*(\d+)\)', decode, re.DOTALL | re.I)
|
156
|
|
- if match:
|
157
|
|
- magic_number = match.group(1)
|
158
|
|
- break
|
159
|
|
-
|
160
|
|
- s = []
|
161
|
|
- for idx, i in enumerate(hiddenurl):
|
162
|
|
- j = ord(i)
|
163
|
|
- if (j >= 33 & j <= 126):
|
164
|
|
- j = 33 + ((j + 14) % 94)
|
165
|
|
-
|
166
|
|
- if idx == len(hiddenurl) - 1:
|
167
|
|
- j += int(magic_number)
|
168
|
|
- s.append(chr(j))
|
169
|
|
- res = ''.join(s)
|
170
|
|
-
|
171
|
|
- videoUrl = 'https://openload.co/stream/{0}?mime=true'.format(res)
|
172
|
|
- dtext = videoUrl.replace('https', 'http')
|
173
|
|
- headers = HTTP_HEADER = {
|
174
|
|
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
|
175
|
|
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
176
|
|
- 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
177
|
|
- 'Accept-Encoding': 'none',
|
178
|
|
- 'Accept-Language': 'en-US,en;q=0.8',
|
179
|
|
- 'Referer': url} # 'Connection': 'keep-alive'
|
180
|
|
-
|
181
|
|
- req = urllib2.Request(dtext, None, headers)
|
182
|
|
- res = urllib2.urlopen(req)
|
183
|
|
- videourl = res.geturl()
|
184
|
|
- #if int(res.headers['Content-Length']) < SIZE_LIMIT:
|
185
|
|
- #raise Exception('Openload.co resolve failed. Pigeons?')
|
186
|
|
- res.close()
|
187
|
|
-
|
188
|
|
- return videourl
|
189
|
|
-
|
190
|
|
-
|
191
|
|
-
|
192
|
|
-# -*- coding: utf-8 -*-
|
193
|
|
-# ------------------------------------------------------------
|
194
|
|
-# pelisalacarta - XBMC Plugin
|
195
|
|
-# Conector for openload.io
|
196
|
|
-# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
|
197
|
|
-# by DrZ3r0
|
198
|
|
-# ------------------------------------------------------------
|
199
|
|
-# Modified by Shani
|
200
|
|
-import re
|
201
|
|
-#from urlresolver import common
|
202
|
|
-#import common
|
203
|
|
-
|
204
|
|
-
|
205
|
|
-class AADecoder(object):
|
206
|
|
- def __init__(self, aa_encoded_data):
|
207
|
|
- self.encoded_str = aa_encoded_data.replace('/*´∇`*/', '')
|
208
|
|
-
|
209
|
|
- self.b = ["(c^_^o)", "(゚Θ゚)", "((o^_^o) - (゚Θ゚))", "(o^_^o)",
|
210
|
|
- "(゚ー゚)", "((゚ー゚) + (゚Θ゚))", "((o^_^o) +(o^_^o))", "((゚ー゚) + (o^_^o))",
|
211
|
|
- "((゚ー゚) + (゚ー゚))", "((゚ー゚) + (゚ー゚) + (゚Θ゚))", "(゚Д゚) .゚ω゚ノ", "(゚Д゚) .゚Θ゚ノ",
|
212
|
|
- "(゚Д゚) ['c']", "(゚Д゚) .゚ー゚ノ", "(゚Д゚) .゚Д゚ノ", "(゚Д゚) [゚Θ゚]"]
|
213
|
|
-
|
214
|
|
- def is_aaencoded(self):
|
215
|
|
- idx = self.encoded_str.find("゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); ")
|
216
|
|
- if idx == -1:
|
217
|
|
- return False
|
218
|
|
-
|
219
|
|
- is_encoded = self.encoded_str.find("(゚Д゚)[゚o゚]) (゚Θ゚)) ('_');", idx) != -1
|
220
|
|
- return is_encoded
|
221
|
|
-
|
222
|
|
- def base_repr(self, number, base=2, padding=0):
|
223
|
|
- digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
224
|
|
- if base > len(digits):
|
225
|
|
- base = len(digits)
|
226
|
|
-
|
227
|
|
- num = abs(number)
|
228
|
|
- res = []
|
229
|
|
- while num:
|
230
|
|
- res.append(digits[num % base])
|
231
|
|
- num //= base
|
232
|
|
- if padding:
|
233
|
|
- res.append('0' * padding)
|
234
|
|
- if number < 0:
|
235
|
|
- res.append('-')
|
236
|
|
- return ''.join(reversed(res or '0'))
|
237
|
|
-
|
238
|
|
- def decode_char(self, enc_char, radix):
|
239
|
|
- end_char = "+ "
|
240
|
|
- str_char = ""
|
241
|
|
- while enc_char != '':
|
242
|
|
- found = False
|
243
|
|
- # for i in range(len(self.b)):
|
244
|
|
- # print self.b[i], enc_char.find(self.b[i])
|
245
|
|
- # if enc_char.find(self.b[i]) == 0:
|
246
|
|
- # str_char += self.base_repr(i, radix)
|
247
|
|
- # enc_char = enc_char[len(self.b[i]):]
|
248
|
|
- # found = True
|
249
|
|
- # break
|
250
|
|
-
|
251
|
|
- # print 'found', found, enc_char
|
252
|
|
- if not found:
|
253
|
|
- for i in range(len(self.b)):
|
254
|
|
- enc_char = enc_char.replace(self.b[i], str(i))
|
255
|
|
- # enc_char = enc_char.replace('(゚Θ゚)', '1').replace('(゚ー゚)', '4').replace('(c^_^o)', '0').replace('(o^_^o)', '3')
|
256
|
|
- # print 'enc_char', enc_char
|
257
|
|
- startpos = 0
|
258
|
|
- findClose = True
|
259
|
|
- balance = 1
|
260
|
|
- result = []
|
261
|
|
- if enc_char.startswith('('):
|
262
|
|
- l = 0
|
263
|
|
-
|
264
|
|
- for t in enc_char[1:]:
|
265
|
|
- l += 1
|
266
|
|
- # print 'looping', findClose, startpos, t, balance
|
267
|
|
- if findClose and t == ')':
|
268
|
|
- balance -= 1
|
269
|
|
- if balance == 0:
|
270
|
|
- result += [enc_char[startpos:l + 1]]
|
271
|
|
- findClose = False
|
272
|
|
- continue
|
273
|
|
- elif not findClose and t == '(':
|
274
|
|
- startpos = l
|
275
|
|
- findClose = True
|
276
|
|
- balance = 1
|
277
|
|
- continue
|
278
|
|
- elif t == '(':
|
279
|
|
- balance += 1
|
280
|
|
-
|
281
|
|
- if result is None or len(result) == 0:
|
282
|
|
- return ""
|
283
|
|
- else:
|
284
|
|
- for r in result:
|
285
|
|
- value = self.decode_digit(r, radix)
|
286
|
|
- # print 'va', value
|
287
|
|
- str_char += value
|
288
|
|
- if value == "":
|
289
|
|
- return ""
|
290
|
|
-
|
291
|
|
- return str_char
|
292
|
|
-
|
293
|
|
- enc_char = enc_char[len(end_char):]
|
294
|
|
-
|
295
|
|
- return str_char
|
296
|
|
-
|
297
|
|
- def parseJSString(self, s):
|
298
|
|
- try:
|
299
|
|
- # print s
|
300
|
|
- # offset = 1 if s[0] == '+' else 0
|
301
|
|
- tmp = (s.replace('!+[]', '1').replace('!![]', '1').replace('[]', '0')) # .replace('(','str(')[offset:])
|
302
|
|
- val = int(eval(tmp))
|
303
|
|
- return val
|
304
|
|
- except:
|
305
|
|
- pass
|
306
|
|
-
|
307
|
|
- def decode_digit(self, enc_int, radix):
|
308
|
|
- # enc_int = enc_int.replace('(゚Θ゚)', '1').replace('(゚ー゚)', '4').replace('(c^_^o)', '0').replace('(o^_^o)', '3')
|
309
|
|
- # print 'enc_int before', enc_int
|
310
|
|
- # for i in range(len(self.b)):
|
311
|
|
- # print self.b[i], enc_char.find(self.b[i])
|
312
|
|
- # if enc_char.find(self.b[i]) > 0:
|
313
|
|
- # str_char += self.base_repr(i, radix)
|
314
|
|
- # enc_char = enc_char[len(self.b[i]):]
|
315
|
|
- # found = True
|
316
|
|
- # break
|
317
|
|
- # enc_int=enc_int.replace(self.b[i], str(i))
|
318
|
|
- # print 'enc_int before', enc_int
|
319
|
|
-
|
320
|
|
- try:
|
321
|
|
- return str(eval(enc_int))
|
322
|
|
- except: pass
|
323
|
|
- rr = '(\(.+?\)\))\+'
|
324
|
|
- rerr = enc_int.split('))+') # re.findall(rr, enc_int)
|
325
|
|
- v = ""
|
326
|
|
- # print rerr
|
327
|
|
- for c in rerr:
|
328
|
|
- if len(c) > 0:
|
329
|
|
- # print 'v', c
|
330
|
|
- if c.strip().endswith('+'):
|
331
|
|
- c = c.strip()[:-1]
|
332
|
|
- # print 'v', c
|
333
|
|
- startbrackets = len(c) - len(c.replace('(', ''))
|
334
|
|
- endbrackets = len(c) - len(c.replace(')', ''))
|
335
|
|
- if startbrackets > endbrackets:
|
336
|
|
- c += ')' * (startbrackets - endbrackets)
|
337
|
|
- if '[' in c:
|
338
|
|
- v += str(self.parseJSString(c))
|
339
|
|
- else:
|
340
|
|
- # print c
|
341
|
|
- v += str(eval(c))
|
342
|
|
- return v
|
343
|
|
-
|
344
|
|
- # unreachable code
|
345
|
|
- # mode 0=+, 1=-
|
346
|
|
- # mode = 0
|
347
|
|
- # value = 0
|
348
|
|
-
|
349
|
|
- # while enc_int != '':
|
350
|
|
- # found = False
|
351
|
|
- # for i in range(len(self.b)):
|
352
|
|
- # if enc_int.find(self.b[i]) == 0:
|
353
|
|
- # if mode == 0:
|
354
|
|
- # value += i
|
355
|
|
- # else:
|
356
|
|
- # value -= i
|
357
|
|
- # enc_int = enc_int[len(self.b[i]):]
|
358
|
|
- # found = True
|
359
|
|
- # break
|
360
|
|
-
|
361
|
|
- # if not found:
|
362
|
|
- # return ""
|
363
|
|
-
|
364
|
|
- # enc_int = re.sub('^\s+|\s+$', '', enc_int)
|
365
|
|
- # if enc_int.find("+") == 0:
|
366
|
|
- # mode = 0
|
367
|
|
- # else:
|
368
|
|
- # mode = 1
|
369
|
|
-
|
370
|
|
- # enc_int = enc_int[1:]
|
371
|
|
- # enc_int = re.sub('^\s+|\s+$', '', enc_int)
|
372
|
|
-
|
373
|
|
- # return self.base_repr(value, radix)
|
374
|
|
-
|
375
|
|
- def decode(self):
|
376
|
|
- self.encoded_str = re.sub('^\s+|\s+$', '', self.encoded_str)
|
377
|
|
-
|
378
|
|
- # get data
|
379
|
|
- pattern = (r"\(゚Д゚\)\[゚o゚\]\+ (.+?)\(゚Д゚\)\[゚o゚\]\)")
|
380
|
|
- result = re.search(pattern, self.encoded_str, re.DOTALL)
|
381
|
|
- if result is None:
|
382
|
|
- #common.log_utils.log_debug("AADecoder: data not found")
|
383
|
|
- print "AADecoder: data not foun"
|
384
|
|
- return False
|
385
|
|
-
|
386
|
|
- data = result.group(1)
|
387
|
|
-
|
388
|
|
- # hex decode string
|
389
|
|
- begin_char = "(゚Д゚)[゚ε゚]+"
|
390
|
|
- alt_char = "(o゚ー゚o)+ "
|
391
|
|
-
|
392
|
|
- out = ''
|
393
|
|
- # print data
|
394
|
|
- while data != '':
|
395
|
|
- # Check new char
|
396
|
|
- if data.find(begin_char) != 0:
|
397
|
|
- #common.log_utils.log_debug("AADecoder: data not found")
|
398
|
|
- print "AADecoder: data not found"
|
399
|
|
- return False
|
400
|
|
-
|
401
|
|
- data = data[len(begin_char):]
|
402
|
|
-
|
403
|
|
- # Find encoded char
|
404
|
|
- enc_char = ""
|
405
|
|
- if data.find(begin_char) == -1:
|
406
|
|
- enc_char = data
|
407
|
|
- data = ""
|
408
|
|
- else:
|
409
|
|
- enc_char = data[:data.find(begin_char)]
|
410
|
|
- data = data[len(enc_char):]
|
411
|
|
-
|
412
|
|
- radix = 8
|
413
|
|
- # Detect radix 16 for utf8 char
|
414
|
|
- if enc_char.find(alt_char) == 0:
|
415
|
|
- enc_char = enc_char[len(alt_char):]
|
416
|
|
- radix = 16
|
417
|
|
-
|
418
|
|
- # print repr(enc_char), radix
|
419
|
|
- # print enc_char.replace('(゚Θ゚)', '1').replace('(゚ー゚)', '4').replace('(c^_^o)', '0').replace('(o^_^o)', '3')
|
420
|
|
-
|
421
|
|
- # print 'The CHAR', enc_char, radix
|
422
|
|
- str_char = self.decode_char(enc_char, radix)
|
423
|
|
-
|
424
|
|
- if str_char == "":
|
425
|
|
- #common.log_utils.log_debug("no match : "),
|
426
|
|
- print "no match : "
|
427
|
|
- #common.log_utils.log_debug(data + "\nout = " + out + "\n")
|
428
|
|
- print data + "\nout = " + out + "\n"
|
429
|
|
- return False
|
430
|
|
- # print 'sofar', str_char, radix,out
|
431
|
|
-
|
432
|
|
- out += chr(int(str_char, radix))
|
433
|
|
- # print 'sfar', chr(int(str_char, radix)), out
|
434
|
|
-
|
435
|
|
- if out == "":
|
436
|
|
- #common.log_utils.log_debug("no match : " + data)
|
437
|
|
- print "no match : " + data
|
438
|
|
- return False
|
439
|
|
-
|
440
|
|
- return out
|
441
|
|
-
|
442
|
|
-
|
443
|
|
-#
|
444
|
|
-# Python version of the jjdecode function written by Syed Zainudeen
|
445
|
|
-# http://csc.cs.utm.my/syed/images/files/jjdecode/jjdecode.html
|
446
|
|
-#
|
447
|
|
-# +NCR/CRC! [ReVeRsEr] - crackinglandia@gmail.com
|
448
|
|
-# Thanks to Jose Miguel Esparza (@EternalTodo) for the final push to make it work!
|
449
|
|
-#
|
450
|
|
-class JJDecoder(object):
|
451
|
|
-
|
452
|
|
- def __init__(self, jj_encoded_data):
|
453
|
|
- self.encoded_str = jj_encoded_data
|
454
|
|
-
|
455
|
|
- def clean(self):
|
456
|
|
- return re.sub('^\s+|\s+$', '', self.encoded_str)
|
457
|
|
-
|
458
|
|
- def checkPalindrome(self, Str):
|
459
|
|
- startpos = -1
|
460
|
|
- endpos = -1
|
461
|
|
- gv, gvl = -1, -1
|
462
|
|
-
|
463
|
|
- index = Str.find('"\'\\"+\'+",')
|
464
|
|
-
|
465
|
|
- if index == 0:
|
466
|
|
- startpos = Str.find('$$+"\\""+') + 8
|
467
|
|
- endpos = Str.find('"\\"")())()')
|
468
|
|
- gv = Str[Str.find('"\'\\"+\'+",') + 9:Str.find('=~[]')]
|
469
|
|
- gvl = len(gv)
|
470
|
|
- else:
|
471
|
|
- gv = Str[0:Str.find('=')]
|
472
|
|
- gvl = len(gv)
|
473
|
|
- startpos = Str.find('"\\""+') + 5
|
474
|
|
- endpos = Str.find('"\\"")())()')
|
475
|
|
-
|
476
|
|
- return (startpos, endpos, gv, gvl)
|
477
|
|
-
|
478
|
|
- def decode(self):
|
479
|
|
-
|
480
|
|
- self.encoded_str = self.clean()
|
481
|
|
- startpos, endpos, gv, gvl = self.checkPalindrome(self.encoded_str)
|
482
|
|
-
|
483
|
|
- if startpos == endpos:
|
484
|
|
- raise Exception('No data!')
|
485
|
|
-
|
486
|
|
- data = self.encoded_str[startpos:endpos]
|
487
|
|
-
|
488
|
|
- b = ['___+', '__$+', '_$_+', '_$$+', '$__+', '$_$+', '$$_+', '$$$+', '$___+', '$__$+', '$_$_+', '$_$$+', '$$__+', '$$_$+', '$$$_+', '$$$$+']
|
489
|
|
-
|
490
|
|
- str_l = '(![]+"")[' + gv + '._$_]+'
|
491
|
|
- str_o = gv + '._$+'
|
492
|
|
- str_t = gv + '.__+'
|
493
|
|
- str_u = gv + '._+'
|
494
|
|
-
|
495
|
|
- str_hex = gv + '.'
|
496
|
|
-
|
497
|
|
- str_s = '"'
|
498
|
|
- gvsig = gv + '.'
|
499
|
|
-
|
500
|
|
- str_quote = '\\\\\\"'
|
501
|
|
- str_slash = '\\\\\\\\'
|
502
|
|
-
|
503
|
|
- str_lower = '\\\\"+'
|
504
|
|
- str_upper = '\\\\"+' + gv + '._+'
|
505
|
|
-
|
506
|
|
- str_end = '"+'
|
507
|
|
-
|
508
|
|
- out = ''
|
509
|
|
- while data != '':
|
510
|
|
- # l o t u
|
511
|
|
- if data.find(str_l) == 0:
|
512
|
|
- data = data[len(str_l):]
|
513
|
|
- out += 'l'
|
514
|
|
- continue
|
515
|
|
- elif data.find(str_o) == 0:
|
516
|
|
- data = data[len(str_o):]
|
517
|
|
- out += 'o'
|
518
|
|
- continue
|
519
|
|
- elif data.find(str_t) == 0:
|
520
|
|
- data = data[len(str_t):]
|
521
|
|
- out += 't'
|
522
|
|
- continue
|
523
|
|
- elif data.find(str_u) == 0:
|
524
|
|
- data = data[len(str_u):]
|
525
|
|
- out += 'u'
|
526
|
|
- continue
|
527
|
|
-
|
528
|
|
- # 0123456789abcdef
|
529
|
|
- if data.find(str_hex) == 0:
|
530
|
|
- data = data[len(str_hex):]
|
531
|
|
-
|
532
|
|
- for i in range(len(b)):
|
533
|
|
- if data.find(b[i]) == 0:
|
534
|
|
- data = data[len(b[i]):]
|
535
|
|
- out += '%x' % i
|
536
|
|
- break
|
537
|
|
- continue
|
538
|
|
-
|
539
|
|
- # start of s block
|
540
|
|
- if data.find(str_s) == 0:
|
541
|
|
- data = data[len(str_s):]
|
542
|
|
-
|
543
|
|
- # check if "R
|
544
|
|
- if data.find(str_upper) == 0: # r4 n >= 128
|
545
|
|
- data = data[len(str_upper):] # skip sig
|
546
|
|
- ch_str = ''
|
547
|
|
- for i in range(2): # shouldn't be more than 2 hex chars
|
548
|
|
- # gv + "."+b[ c ]
|
549
|
|
- if data.find(gvsig) == 0:
|
550
|
|
- data = data[len(gvsig):]
|
551
|
|
- for k in range(len(b)): # for every entry in b
|
552
|
|
- if data.find(b[k]) == 0:
|
553
|
|
- data = data[len(b[k]):]
|
554
|
|
- ch_str = '%x' % k
|
555
|
|
- break
|
556
|
|
- else:
|
557
|
|
- break
|
558
|
|
-
|
559
|
|
- out += chr(int(ch_str, 16))
|
560
|
|
- continue
|
561
|
|
-
|
562
|
|
- elif data.find(str_lower) == 0: # r3 check if "R // n < 128
|
563
|
|
- data = data[len(str_lower):] # skip sig
|
564
|
|
-
|
565
|
|
- ch_str = ''
|
566
|
|
- ch_lotux = ''
|
567
|
|
- temp = ''
|
568
|
|
- b_checkR1 = 0
|
569
|
|
- for j in range(3): # shouldn't be more than 3 octal chars
|
570
|
|
- if j > 1: # lotu check
|
571
|
|
- if data.find(str_l) == 0:
|
572
|
|
- data = data[len(str_l):]
|
573
|
|
- ch_lotux = 'l'
|
574
|
|
- break
|
575
|
|
- elif data.find(str_o) == 0:
|
576
|
|
- data = data[len(str_o):]
|
577
|
|
- ch_lotux = 'o'
|
578
|
|
- break
|
579
|
|
- elif data.find(str_t) == 0:
|
580
|
|
- data = data[len(str_t):]
|
581
|
|
- ch_lotux = 't'
|
582
|
|
- break
|
583
|
|
- elif data.find(str_u) == 0:
|
584
|
|
- data = data[len(str_u):]
|
585
|
|
- ch_lotux = 'u'
|
586
|
|
- break
|
587
|
|
-
|
588
|
|
- # gv + "."+b[ c ]
|
589
|
|
- if data.find(gvsig) == 0:
|
590
|
|
- temp = data[len(gvsig):]
|
591
|
|
- for k in range(8): # for every entry in b octal
|
592
|
|
- if temp.find(b[k]) == 0:
|
593
|
|
- if int(ch_str + str(k), 8) > 128:
|
594
|
|
- b_checkR1 = 1
|
595
|
|
- break
|
596
|
|
-
|
597
|
|
- ch_str += str(k)
|
598
|
|
- data = data[len(gvsig):] # skip gvsig
|
599
|
|
- data = data[len(b[k]):]
|
600
|
|
- break
|
601
|
|
-
|
602
|
|
- if b_checkR1 == 1:
|
603
|
|
- if data.find(str_hex) == 0: # 0123456789abcdef
|
604
|
|
- data = data[len(str_hex):]
|
605
|
|
- # check every element of hex decode string for a match
|
606
|
|
- for i in range(len(b)):
|
607
|
|
- if data.find(b[i]) == 0:
|
608
|
|
- data = data[len(b[i]):]
|
609
|
|
- ch_lotux = '%x' % i
|
610
|
|
- break
|
611
|
|
- break
|
612
|
|
- else:
|
613
|
|
- break
|
614
|
|
-
|
615
|
|
- out += chr(int(ch_str, 8)) + ch_lotux
|
616
|
|
- continue
|
617
|
|
-
|
618
|
|
- else: # "S ----> "SR or "S+
|
619
|
|
- # if there is, loop s until R 0r +
|
620
|
|
- # if there is no matching s block, throw error
|
621
|
|
-
|
622
|
|
- match = 0
|
623
|
|
- n = None
|
624
|
|
-
|
625
|
|
- # searching for matching pure s block
|
626
|
|
- while True:
|
627
|
|
- n = ord(data[0])
|
628
|
|
- if data.find(str_quote) == 0:
|
629
|
|
- data = data[len(str_quote):]
|
630
|
|
- out += '"'
|
631
|
|
- match += 1
|
632
|
|
- continue
|
633
|
|
- elif data.find(str_slash) == 0:
|
634
|
|
- data = data[len(str_slash):]
|
635
|
|
- out += '\\'
|
636
|
|
- match += 1
|
637
|
|
- continue
|
638
|
|
- elif data.find(str_end) == 0: # reached end off S block ? +
|
639
|
|
- if match == 0:
|
640
|
|
- raise '+ no match S block: ' + data
|
641
|
|
- data = data[len(str_end):]
|
642
|
|
- break # step out of the while loop
|
643
|
|
- elif data.find(str_upper) == 0: # r4 reached end off S block ? - check if "R n >= 128
|
644
|
|
- if match == 0:
|
645
|
|
- raise 'no match S block n>128: ' + data
|
646
|
|
- data = data[len(str_upper):] # skip sig
|
647
|
|
-
|
648
|
|
- ch_str = ''
|
649
|
|
- ch_lotux = ''
|
650
|
|
-
|
651
|
|
- for j in range(10): # shouldn't be more than 10 hex chars
|
652
|
|
- if j > 1: # lotu check
|
653
|
|
- if data.find(str_l) == 0:
|
654
|
|
- data = data[len(str_l):]
|
655
|
|
- ch_lotux = 'l'
|
656
|
|
- break
|
657
|
|
- elif data.find(str_o) == 0:
|
658
|
|
- data = data[len(str_o):]
|
659
|
|
- ch_lotux = 'o'
|
660
|
|
- break
|
661
|
|
- elif data.find(str_t) == 0:
|
662
|
|
- data = data[len(str_t):]
|
663
|
|
- ch_lotux = 't'
|
664
|
|
- break
|
665
|
|
- elif data.find(str_u) == 0:
|
666
|
|
- data = data[len(str_u):]
|
667
|
|
- ch_lotux = 'u'
|
668
|
|
- break
|
669
|
|
-
|
670
|
|
- # gv + "."+b[ c ]
|
671
|
|
- if data.find(gvsig) == 0:
|
672
|
|
- data = data[len(gvsig):] # skip gvsig
|
673
|
|
- for k in range(len(b)): # for every entry in b
|
674
|
|
- if data.find(b[k]) == 0:
|
675
|
|
- data = data[len(b[k]):]
|
676
|
|
- ch_str += '%x' % k
|
677
|
|
- break
|
678
|
|
- else:
|
679
|
|
- break # done
|
680
|
|
- out += chr(int(ch_str, 16))
|
681
|
|
- break # step out of the while loop
|
682
|
|
- elif data.find(str_lower) == 0: # r3 check if "R // n < 128
|
683
|
|
- if match == 0:
|
684
|
|
- raise 'no match S block n<128: ' + data
|
685
|
|
-
|
686
|
|
- data = data[len(str_lower):] # skip sig
|
687
|
|
-
|
688
|
|
- ch_str = ''
|
689
|
|
- ch_lotux = ''
|
690
|
|
- temp = ''
|
691
|
|
- b_checkR1 = 0
|
692
|
|
-
|
693
|
|
- for j in range(3): # shouldn't be more than 3 octal chars
|
694
|
|
- if j > 1: # lotu check
|
695
|
|
- if data.find(str_l) == 0:
|
696
|
|
- data = data[len(str_l):]
|
697
|
|
- ch_lotux = 'l'
|
698
|
|
- break
|
699
|
|
- elif data.find(str_o) == 0:
|
700
|
|
- data = data[len(str_o):]
|
701
|
|
- ch_lotux = 'o'
|
702
|
|
- break
|
703
|
|
- elif data.find(str_t) == 0:
|
704
|
|
- data = data[len(str_t):]
|
705
|
|
- ch_lotux = 't'
|
706
|
|
- break
|
707
|
|
- elif data.find(str_u) == 0:
|
708
|
|
- data = data[len(str_u):]
|
709
|
|
- ch_lotux = 'u'
|
710
|
|
- break
|
711
|
|
-
|
712
|
|
- # gv + "."+b[ c ]
|
713
|
|
- if data.find(gvsig) == 0:
|
714
|
|
- temp = data[len(gvsig):]
|
715
|
|
- for k in range(8): # for every entry in b octal
|
716
|
|
- if temp.find(b[k]) == 0:
|
717
|
|
- if int(ch_str + str(k), 8) > 128:
|
718
|
|
- b_checkR1 = 1
|
719
|
|
- break
|
720
|
|
-
|
721
|
|
- ch_str += str(k)
|
722
|
|
- data = data[len(gvsig):] # skip gvsig
|
723
|
|
- data = data[len(b[k]):]
|
724
|
|
- break
|
725
|
|
-
|
726
|
|
- if b_checkR1 == 1:
|
727
|
|
- if data.find(str_hex) == 0: # 0123456789abcdef
|
728
|
|
- data = data[len(str_hex):]
|
729
|
|
- # check every element of hex decode string for a match
|
730
|
|
- for i in range(len(b)):
|
731
|
|
- if data.find(b[i]) == 0:
|
732
|
|
- data = data[len(b[i]):]
|
733
|
|
- ch_lotux = '%x' % i
|
734
|
|
- break
|
735
|
|
- else:
|
736
|
|
- break
|
737
|
|
- out += chr(int(ch_str, 8)) + ch_lotux
|
738
|
|
- break # step out of the while loop
|
739
|
|
- elif (0x21 <= n and n <= 0x2f) or (0x3A <= n and n <= 0x40) or (0x5b <= n and n <= 0x60) or (0x7b <= n and n <= 0x7f):
|
740
|
|
- out += data[0]
|
741
|
|
- data = data[1:]
|
742
|
|
- match += 1
|
743
|
|
- continue
|
744
|
|
- print 'No match : ' + data
|
745
|
|
- break
|
746
|
|
- return out
|
747
|
|
-
|
748
|
|
-if __name__ == "__main__":
|
749
|
|
-
|
750
|
|
- from subprocess import call
|
751
|
|
- #url = "http://hqq.tv/player/embed_player.php?vid=235238210241210222228241233208212245&autoplay=no"
|
752
|
|
- #url = "http://hqq.tv/player/embed_player.php?vid=243221241234244238208213206212211231&autoplay=no"
|
753
|
|
- url = "http://hqq.tv/player/embed_player.php?vid=208231211231207221227243206206221244&autoplay=no"
|
754
|
|
- #url = "https://openload.co/embed/TMthIdpy4PI/"
|
755
|
|
- #url = "https://www.youtube.com/watch?v=Tx1K51_F99o"
|
756
|
|
- #url = "https://www.youtube.com/watch?v=8BkcX7O1890"
|
757
|
|
- #url = "https://www.youtube.com/watch?v=Se07R8SYsg0"
|
758
|
|
- #url = "https://kinostok.tv/embed/731f3437e3c53104dd56d04039a0b15a"
|
759
|
|
- #url = "http://vk.com/video_ext.php?oid=246066565&id=169244575&hash=d430ab0e76c9f7a1&hd=3"
|
760
|
|
- #url ="https://openload.co/embed/rPMXJYPTkw4/"
|
761
|
|
- #url = "https://openload.co/embed/bE7WfZ-vz_A/"
|
762
|
|
- #url = "https://openload.co/embed/bE7WfZ/"
|
763
|
|
- #url = "https://openload.co/embed/OuskaKyC2GU/"
|
764
|
|
- url = "http://hqq.tv/player/embed_player.php?vid=235238210241210222228241233208212245&autoplay=no"
|
765
|
|
- url = "https://openload.co/embed/rmNcP-0QopE/"
|
766
|
|
- url = "https://openload.co/embed/oQLXcU1ITAY/"
|
767
|
|
- streams = resolve(url)
|
768
|
|
- if not streams:
|
769
|
|
- print "No streams found"
|
770
|
|
- sys.exit()
|
771
|
|
-
|
772
|
|
- for s in streams:
|
773
|
|
- print s
|
774
|
|
-
|
775
|
|
- print streams[0]["url"]
|
776
|
|
- call([r"c:\Program Files\VideoLAN\VLC\vlc.exe",streams[0]["url"]])
|
777
|
|
- pass
|