Skip to content

Commit ab8e561

Browse files
committed
jsunpack non ascii strings
1 parent 67fb8da commit ab8e561

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/resolveurl/plugins/lib/helpers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ def append_headers(headers):
8383
def get_packed_data(html):
8484
packed_data = ''
8585
for match in re.finditer(r'(eval\s*\(function.*?)</script>', html, re.DOTALL | re.I):
86-
try:
86+
if jsunpack.detect(match.group(1)):
8787
js_data = jsunpack.unpack(match.group(1))
8888
js_data = js_data.replace('\\', '')
8989
packed_data += js_data
90-
except:
91-
pass
9290

9391
return packed_data
9492

lib/resolveurl/plugins/lib/jsunpack.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
2-
resolveurl XBMC Addon
2+
ResolveUrl Kodi Addon
33
Copyright (C) 2018 jsergio
4+
Copyright (C) 2021 jairoxyz
45
56
This program is free software: you can redistribute it and/or modify
67
it under the terms of the GNU General Public License as published by
@@ -56,7 +57,10 @@ def unpack(source):
5657
def lookup(match):
5758
"""Look up symbols in the synthetic symtab."""
5859
word = match.group(0)
59-
word2 = symtab[int(word)] if radix == 1 else symtab[unbase(word)]
60+
try:
61+
word2 = symtab[int(word)] if radix == 1 else symtab[unbase(word)]
62+
except:
63+
word2 = None
6064
return word2 or word
6165

6266
source = re.sub(r'\b\w+\b', lookup, payload)

lib/resolveurl/plugins/userload.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
class UserLoadResolver(ResolveUrl):
2626
name = "UserLoad"
2727
domains = ['userload.co']
28-
pattern = r'(?://|\.)(userload\.co)/f/([0-9a-zA-Z]+)'
28+
pattern = r'(?://|\.)(userload\.co)/(?:e|f)/([0-9a-zA-Z]+)'
2929

3030
def get_media_url(self, host, media_id):
3131
web_url = self.get_url(host, media_id)
3232
blurl = 'https://{0}/api/assets/userload/js/form.framework.js'.format(host)
3333
headers = {'User-Agent': common.RAND_UA}
3434
html = self.net.http_GET(web_url, headers=headers).content
3535
html = helpers.get_packed_data(html)
36+
headers.update({'Referer': web_url})
3637
bl = self.net.http_GET(blurl, headers=headers).content
3738
if jsunhunt.detect(bl):
3839
bl = jsunhunt.unhunt(bl)
@@ -50,8 +51,7 @@ def get_media_url(self, host, media_id):
5051
api_url = 'https://{0}{1}'.format(host, b1.group(1))
5152
headers.update({
5253
'X-Requested-With': 'XMLHttpRequest',
53-
'Origin': 'https://{0}'.format(host),
54-
'Referer': web_url
54+
'Origin': 'https://{0}'.format(host)
5555
})
5656
stream_url = self.net.http_POST(api_url, data, headers=headers).content
5757
headers.pop('X-Requested-With')
@@ -61,4 +61,4 @@ def get_media_url(self, host, media_id):
6161
raise ResolverError('File not found')
6262

6363
def get_url(self, host, media_id):
64-
return self._default_get_url(host, media_id, template='https://{host}/f/{media_id}')
64+
return self._default_get_url(host, media_id, template='https://{host}/e/{media_id}')

0 commit comments

Comments
 (0)