def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) common.addon.log('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content r = re.findall('File Not Found', html) if r: raise Exception('File Not Found or removed') #Check page for any error msgs if re.search('<b>File Not Found</b>', html): common.addon.log('***** HugeFiles - File Not Found') raise Exception('File Not Found') #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' #Check for SolveMedia Captcha image solvemedia = re.search( '<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search( '<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update( captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile( "left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1]) - 48) for num in result) data.update({'code': solution}) common.addon.log('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = net.http_POST(url, data).content r = re.search('fileUrl\s*=\s*"([^"]+)', html) if r: return r.group(1) raise Exception('Unable to resolve HugeFiles Link') except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, url)) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): try: puzzle_img = os.path.join(datapath, "ctv_puzzle.png") url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value data.update({'method_free':'Create Streaming Link'}) html = net.http_POST(url, data).content r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) for name, value in r: data[name] = value #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1), puzzle_img)) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) html = net.http_POST(url, data).content if re.findall('err', html): raise Exception('Wrong Captcha') sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\(' sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)' sPattern += '\s+?</script>' r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) if r: sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)' sPattern += '"custommode=' r = re.search(sPattern, sUnpacked) if r: return r.group(1) else: prea = re.compile('wmff\|(.+?)\|flvplayer').findall(html) for slave in prea: pre = 'http://'+slave+'.wmff.org:182/d/' preb = re.compile('image\|(.+?)(?:\|)\|video\|(.+?)\|').findall(html) for ext, link in preb: r = pre+link+'/video.'+ext return r except Exception, e: common.addon.log('**** Clicktoview Error occured: %s' % e) common.addon.show_small_popup('Error', str(e), 5000, '') return self.unresolvable(code=0, msg='Exception: %s' % e)
def __get_link(self, url): try: common.addon.log_debug('180upload: get_link: %s' % (url)) html = net.http_GET(url).content #Re-grab data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) if r: for name, value in r: data[name] = value else: raise Exception('Unable to resolve 180Upload Link') # ignore captchas in embedded pages if 'embed' not in url: #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) common.addon.log_debug('180Upload - Requesting POST URL: %s with data: %s' % (url, data)) data['referer'] = url html = net.http_POST(url, data).content # try download link link = re.search('id="lnk_download[^"]*" href="([^"]+)', html) if link: common.addon.log_debug('180Upload Download Found: %s' % link.group(1)) return link.group(1) else: # try flash player link packed = re.search('id="player_code".*?(eval.*?)</script>', html, re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) link = re.search('name="src"\s*value="([^"]+)', js.replace('\\', '')) if link: common.addon.log_debug('180Upload Src Found: %s' % link.group(1)) return link.group(1) else: link = re.search("'file'\s*,\s*'([^']+)", js.replace('\\', '')) if link: common.addon.log_debug('180Upload Link Found: %s' % link.group(1)) return link.group(1) raise Exception('Unable to resolve 180Upload Link') except urllib2.URLError as e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, url)) return self.unresolvable(code=3, msg=e) except Exception as e: common.addon.log_error('**** 180upload Error occured: %s' % e) return self.unresolvable(code=0, msg=e)
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: puzzle_img = os.path.join(datapath, "vidplay_puzzle.png") html = net.http_GET(web_url).content if re.search('File Not Found ',html): msg = 'File Not Found or removed' common.addon.show_small_popup(title='[B][COLOR white]VIDPLAY[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % msg, delay=5000, image=error_logo) return self.unresolvable(code = 1, msg = msg) data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: raise Exception('Unable to resolve vidplay Link') #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1), puzzle_img)) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) common.addon.log('VIDPLAY - Requesting POST URL: %s with data: %s' % (web_url, data)) html = net.http_POST(web_url, data).content sPattern = '''<div id="player_code">.*?<script type='text/javascript'>(eval.+?)</script>''' r = re.findall(sPattern, html, re.DOTALL|re.I) if r: sUnpacked = jsunpack.unpack(r[0]) sUnpacked = sUnpacked.replace("\\'","") r = re.findall('file,(.+?)\)\;s1',sUnpacked) if not r: r = re.findall('name="src"[0-9]*="(.+?)"/><embed',sUnpacked) if not r: r = re.findall('<param name="src"value="(.+?)"/>', sUnpacked) return r[0] else: common.addon.log('***** VidPlay - Cannot find final link') raise Exception('Unable to resolve VidPlay Link') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): embed_url = 'http://vidplay.net/vidembed-%s' % (media_id) response = urllib2.urlopen(embed_url) if response.getcode() == 200 and response.geturl() != embed_url and response.geturl()[-3:].lower() in ['mp4', 'avi', 'mkv']: return response.geturl() web_url = self.get_url(host, media_id) try: html = net.http_GET(web_url).content if re.search('File Not Found ', html): msg = 'File Not Found or removed' return self.unresolvable(code=1, msg=msg) data = {} r = re.findall(r'type="hidden".*?name="([^"]+)".*?value="([^"]+)', html) if r: for name, value in r: data[name] = value else: raise Exception('Unable to resolve vidplay Link') #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1]) - 48) for num in result) data.update({'code': solution}) common.addon.log_debug('VIDPLAY - Requesting POST URL: %s with data: %s' % (web_url, data)) html = net.http_POST(web_url, data).content r = re.search('id="downloadbutton".*?href="([^"]+)', html) if r: return r.group(1) else: r = re.search("file\s*:\s*'([^']+)", html) if r: return r.group(1) else: common.addon.log('***** VidPlay - Cannot find final link') raise Exception('Unable to resolve VidPlay Link') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: html = net.http_GET(web_url).content if re.search('File Not Found ',html): msg = 'File Not Found or removed' return self.unresolvable(code = 1, msg = msg) data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: raise Exception('Unable to resolve vidplay Link') #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) common.addon.log('VIDPLAY - Requesting POST URL: %s with data: %s' % (web_url, data)) html = net.http_POST(web_url, data).content sPattern = '''<div id="player_code">.*?<script type='text/javascript'>(eval.+?)</script>''' r = re.findall(sPattern, html, re.DOTALL|re.I) if r: sUnpacked = jsunpack.unpack(r[0]) sUnpacked = sUnpacked.replace("\\'","") r = re.findall('file,(.+?)\)\;s1',sUnpacked) if not r: r = re.findall('name="src"[0-9]*="(.+?)"/><embed',sUnpacked) if not r: r = re.findall('<param name="src"value="(.+?)"/>', sUnpacked) return r[0] else: common.addon.log('***** VidPlay - Cannot find final link') raise Exception('Unable to resolve VidPlay Link') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value data.update({'plugins_are_not_allowed_plus_ban':2}) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) html = net.http_POST(url, data).content if re.findall('err', html): raise Exception('Wrong Captcha') sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\(' sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)' sPattern += '\s+?</script>' r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) if r: sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)' sPattern += '"custommode=' r = re.search(sPattern, sUnpacked) if r: return r.group(1) else: num = re.compile('false\|(.+?)\|(.+?)\|(.+?)\|(.+?)\|divx').findall(html) common.addon.log('NUM: '+str(num)) for u1, u2, u3, u4 in num: urlz = u4+'.'+u3+'.'+u2+'.'+u1 pre = 'http://'+urlz+':182/d/' preb = re.compile('custommode\|(.+?)\|(.+?)\|182').findall(html) for ext, link in preb: r = pre+link+'/video.'+ext return r except Exception, e: common.addon.log('**** Megarelease Error occured: %s' % e) common.addon.show_small_popup('Error', str(e), 5000, '') return self.unresolvable(code=0, msg='Exception: %s' % e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) common.addon.log('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content r = re.findall('File Not Found', html) if r: raise Exception('File Not Found or removed') #Check page for any error msgs if re.search('<b>File Not Found</b>', html): common.addon.log('***** HugeFiles - File Not Found') raise Exception('File Not Found') #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1]) - 48) for num in result) data.update({'code': solution}) common.addon.log('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = net.http_POST(url, data).content r = re.search('fileUrl\s*=\s*"([^"]+)', html) if r: return r.group(1) raise Exception('Unable to resolve HugeFiles Link') except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, url)) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value data.update({'plugins_are_not_allowed_plus_ban':2}) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) html = net.http_POST(url, data).content if re.findall('err', html): raise Exception('Wrong Captcha') sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\(' sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)' sPattern += '\s+?</script>' r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) if r: sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)' sPattern += '"custommode=' r = re.search(sPattern, sUnpacked) if r: return r.group(1) else: num = re.compile('false\|(.+?)\|(.+?)\|(.+?)\|(.+?)\|divx').findall(html) common.addon.log('NUM: '+str(num)) for u1, u2, u3, u4 in num: urlz = u4+'.'+u3+'.'+u2+'.'+u1 pre = 'http://'+urlz+':182/d/' preb = re.compile('custommode\|(.+?)\|(.+?)\|182').findall(html) for ext, link in preb: r = pre+link+'/video.'+ext return r except Exception, e: common.addon.log('**** Megarelease Error occured: %s' % e) return self.unresolvable(code=0, msg='Exception: %s' % e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) common.addon.log('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content r = re.findall('File Not Found', html) if r: raise Exception('File Not Found or removed') #Check page for any error msgs if re.search('<b>File Not Found</b>', html): common.addon.log('***** HugeFiles - File Not Found') raise Exception('File Not Found') #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' file_name = data['fname'] #Check for SolveMedia Captcha image solvemedia = re.search( '<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search( '<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update( captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile( "left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1]) - 48) for num in result) data.update({'code': solution}) common.addon.log('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = net.http_POST(url, data).content # issue one more time for download link #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' # can't use t0mm0 net because the post doesn't return until the file is downloaded request = urllib2.Request(url, urllib.urlencode(data)) response = urllib2.urlopen(request) stream_url = response.geturl() # assume that if the final url matches the original url that the process failed if stream_url == url: raise Exception('Unable to find stream url') return stream_url except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, url)) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): common.addon.log('180upload: in get_media_url %s %s' % (host, media_id)) web_url = 'http://180upload.com/embed-%s.html' % media_id try: common.addon.log('180Upload - Requesting GET URL: %s' % web_url) html = net.http_GET(web_url).content # Check for file not found if re.search('File Not Found', html): common.addon.log_error(self.name + ' - File Not Found') xbmc.executebuiltin('XBMC.Notification([B][COLOR white]180Upload[/COLOR][/B],[COLOR red]File has been deleted[/COLOR],8000,'+error_logo+')') return self.unresolvable(code=1, msg='File Not Found') data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) if r: for name, value in r: data[name] = value data['referer'] = web_url else: raise Exception('Cannot find data values') # 1st attempt, probably no captcha common.addon.log('180Upload - Requesting POST URL: %s' % web_url) html = net.http_POST(web_url, data).content packed = re.search('id="player_code".*?(eval.*?\)\)\))', html,re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) link = re.search('name="src"*0="([^"]+)"/>', js.replace('\\','')) if link: common.addon.log('180Upload Link Found: %s' % link.group(1)) return link.group(1) else: link = re.search("'file','(.+?)'", js.replace('\\','')) if link: common.addon.log('180Upload Link Found: %s' % link.group(1)) return link.group(1) web_url = self.get_url(host, media_id) html = net.http_GET(web_url).content #Re-grab data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) if r: for name, value in r: data[name] = value else: raise Exception('Unable to resolve 180Upload Link') #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) common.addon.log('180Upload - Requesting POST URL: %s with data: %s' % (web_url, data)) html = net.http_POST(web_url, data).content link = re.search('id="lnk_download" href="([^"]+)', html) if link: common.addon.log('180Upload Link Found: %s' % link.group(1)) return link.group(1) else: raise Exception('Unable to resolve 180Upload Link') except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) puzzle_img = os.path.join(common.profile_path, "hugefiles_puzzle.png") common.addon.log('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content r = re.findall('File Not Found',html) if r: raise Exception ('File Not Found or removed') #Check page for any error msgs if re.search('<b>File Not Found</b>', html): common.addon.log('***** HugeFiles - File Not Found') raise Exception('File Not Found') #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' file_name = data['fname'] #Check for SolveMedia Captcha image solvemedia = re.search('<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search('<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update(captcha_lib.do_solvemedia_captcha(solvemedia.group(1), puzzle_img)) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile("left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1])-48) for num in result) data.update({'code':solution}) common.addon.log('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = net.http_POST(url, data).content # issue one more time for download link #Set POST data values data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) if r: for name, value in r: data[name] = value else: common.addon.log('***** HugeFiles - Cannot find data values') raise Exception('Unable to resolve HugeFiles Link') data['method_free'] = 'Free Download' # can't use t0mm0 net because the post doesn't return until the file is downloaded request = urllib2.Request(url, urllib.urlencode(data)) response = urllib2.urlopen(request) stream_url = response.geturl() # assume that if the final url matches the original url that the process failed if stream_url == url: raise Exception('Unable to find stream url') return stream_url except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' %(e.code, url)) common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e)
def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value data.update({'method_free': 'Create Streaming Link'}) html = net.http_POST(url, data).content r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) for name, value in r: data[name] = value #Check for SolveMedia Captcha image solvemedia = re.search( '<iframe src="(http://api.solvemedia.com.+?)"', html) recaptcha = re.search( '<script type="text/javascript" src="(http://www.google.com.+?)">', html) if solvemedia: data.update( captcha_lib.do_solvemedia_captcha(solvemedia.group(1))) elif recaptcha: data.update(captcha_lib.do_recaptcha(recaptcha.group(1))) else: captcha = re.compile( "left:(\d+)px;padding-top:\d+px;'>&#(.+?);<").findall(html) result = sorted(captcha, key=lambda ltr: int(ltr[0])) solution = ''.join(str(int(num[1]) - 48) for num in result) data.update({'code': solution}) html = net.http_POST(url, data).content if re.findall('err', html): raise Exception('Wrong Captcha') sPattern = '<script type=(?:"|\')text/javascript(?:"|\')>(eval\(' sPattern += 'function\(p,a,c,k,e,d\)(?!.+player_ads.+).+np_vid.+?)' sPattern += '\s+?</script>' r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) if r: sJavascript = r.group(1) sUnpacked = jsunpack.unpack(sJavascript) sPattern = '<embed id="np_vid"type="video/divx"src="(.+?)' sPattern += '"custommode=' r = re.search(sPattern, sUnpacked) if r: return r.group(1) else: prea = re.compile('wmff\|(.+?)\|flvplayer').findall(html) for slave in prea: pre = 'http://' + slave + '.wmff.org:182/d/' preb = re.compile( 'image\|(.+?)(?:\|)\|video\|(.+?)\|').findall(html) for ext, link in preb: r = pre + link + '/video.' + ext return r except Exception, e: common.addon.log('**** Clicktoview Error occured: %s' % e) common.addon.show_small_popup('Error', str(e), 5000, '') return self.unresolvable(code=0, msg='Exception: %s' % e)