Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def decode(self, resp):
- listRe = re.compile('var\s+\w{3}\s+=\s+(\[.+?\]);',re.DOTALL)
- minusRe = re.compile('\s+\-\s+(\d{,10})\);')
- iframeRe = re.compile('<iframe.+?src=["\'](\S{10,})["\']')
- packerRe = re.compile('(eval\(function\(p,a,c,k,e,(?:r|d).*)')
- clapprRe = re.compile('new\s+Clappr\.Player\(\{\s*?source:\s*?["\'](.+?)["\']')
- hParse = HTMLParser()
- jsList = listRe.findall(resp)[0]
- minusValue = int(minusRe.findall(resp)[0])
- valuesList = eval(jsList)
- iframePage = hParse.unescape(unquote(''.join(map(chr,
- [int(''.join([x for x in
- base64.b64decode(valueInList)
- if x.isdigit()])) - minusValue
- for valueInList in valuesList]))))
- iframe_url = iframeRe.findall(iframePage)[0]
- packerPage = requests.get(iframe_url).text
- packed = packerRe.findall(packerPage)[0]
- unpacked = jsunpack.unpack(packed)
- clapprStream = clapprRe.findall(unpacked)[0]
- headers = '|Referer=%s&User-Agent=%s' % (iframe_url, ua_string)
- return clapprStream + headers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement