def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) link = self.net.http_GET(web_url).content if link.find('no video details found') >= 0: raise UrlResolver.ResolverError( 'The requested video was not found.') videoUrl = re.compile( "(?:hq_video_file|normal_video_file|mobile_video_file)\s+\=\s+(?:\'|\")([\w\.\/\:\-\?\=]+)(?:\'|\")" ).findall(link) vUrl = '' vUrlsCount = len(videoUrl) if vUrlsCount > 0: q = self.get_setting('quality') if q == '0': # Highest Quality vUrl = videoUrl[0] elif q == '1': # Medium Quality vUrl = videoUrl[(int)(vUrlsCount / 2)] elif q == '2': # Lowest Quality vUrl = videoUrl[vUrlsCount - 1] return vUrl else: raise UrlResolver.ResolverError('No playable video found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'Referer': web_url, 'User-Agent': common.IE_USER_AGENT} html = self.net.http_GET(web_url).content data = {} r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) if r: for name, value in r: data[name] = value data['referer'] = web_url data['imhuman'] = 'Proceed to video' xbmc.sleep(6000) # don't replace with countdown, crashes on linux html = self.net.http_POST(web_url, data, headers=headers).content match = re.search('(eval\(function.*)\s*</script>', html, re.DOTALL) if match: packed_data = match.group(1) js_data = jsunpack.unpack(packed_data) max_label = 0 stream_url = '' for match in re.finditer( 'label:\s*"(\d+)p"\s*,\s*file:\s*"([^"]+)', js_data): label, link = match.groups() if int(label) > max_label: stream_url = link max_label = int(label) if stream_url: return stream_url else: raise UrlResolver.ResolverError("File Link Not Found") else: raise UrlResolver.ResolverError("Packed Data Not Found")
def get_media_url(self, host, media_id): self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if re.search('This server is in maintenance mode', html): raise UrlResolver.ResolverError('File is currently unavailable on the host') 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 UrlResolver.ResolverError('Cannot find data values') data['btn_download'] = 'Continue to Video' r = re.search('<span id="countdown_str">Wait <span id=".+?">(.+?)</span> seconds</span>', html) if r: wait_time = r.group(1) else: wait_time = 2 # default to 2 seconds xbmc.sleep(int(wait_time) * 1000) html = self.net.http_POST(web_url, data).content r = re.search('href="([^"]+)">Download Link', html) if r: return r.group(1) else: raise UrlResolver.ResolverError('Unable to locate Download Link')
def get_media_url(self, host, media_id): try: info_url = 'https://api.openload.io/1/file/info?file=%s' % ( media_id) js_result = self.__get_json(info_url) if 'result' in js_result and media_id in js_result['result']: if js_result['result'][media_id]['status'] != 200: raise UrlResolver.ResolverError('File Not Available') ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % ( media_id) js_result = self.__get_json(ticket_url) video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % ( media_id, js_result['result']['ticket']) captcha_url = js_result['result'].get('captcha_url', None) if captcha_url: captcha_response = captcha_lib.get_response(captcha_url) if captcha_response: video_url += '&captcha_response=%s' % urllib.quote( captcha_response) xbmc.sleep(js_result['result']['wait_time'] * 1000) js_result = self.__get_json(video_url) return js_result['result']['url'] + '?mime=true' except UrlResolver.ResolverError: raise except Exception as e: raise UrlResolver.ResolverError('Exception in openload: %s' % (e)) raise UrlResolver.ResolverError( 'Unable to resolve openload.io link. Filelink not found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = None if 'chan=' in web_url: html = self.net.http_GET(web_url, headers=self.headers).content r = re.search( '<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html) if r: web_url = r.group(1) r = re.search('.+?a=([0-9]+).+', web_url) if r: web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group( 1) html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: stream_url = r.group(1) else: r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html) if r: try: stream_url = r.group(1).decode('base64', 'strict') except Exception: raise UrlResolver.ResolverError('Failed to decode url') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None headers = {'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content if "This video doesn't exist." in html: raise UrlResolver.ResolverError( 'The requested video was not found.') packed = re.search('(eval\(function\(p,a,c,k,e,d\)\{.+\))', html) unpacked = None if packed: # change radix before trying to unpack, 58-61 seen in testing, 62 worked for all packed = re.sub( r"(.+}\('.*', *)\d+(, *\d+, *'.*?'\.split\('\|'\))", "\g<01>62\g<02>", packed.group(1)) unpacked = jsunpack.unpack(packed) if unpacked: r = re.search('.+["\']file["\']\s*:\s*["\'](.+?/video\\\.+?)["\']', unpacked) if r: stream_url = r.group(1).replace('\\', '') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = { 'User-Agent': common.IOS_USER_AGENT, 'Referer': web_url } html = self.net.http_GET(web_url, headers=headers).content if jsunpack.detect(html): js_data = jsunpack.unpack(html) match = re.search('"src"\s*,\s*"([^"]+)', js_data) try: stream_url = match.group(1) r = urllib2.Request(stream_url, headers=headers) r = int(urllib2.urlopen(r, timeout=15).headers['Content-Length']) if r > 1048576: stream_url += '|' + urllib.urlencode(headers) return stream_url except: UrlResolver.ResolverError("File Not Playable") raise UrlResolver.ResolverError('No playable video found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content #send all form values sPattern = '<input.*?name="([^"]+)".*?value=([^>]+)>' r = re.findall(sPattern, html) data = {} if r: for match in r: name = match[0] value = match[1].replace('"', '') data[name] = value html = self.net.http_POST(web_url, data).content else: raise UrlResolver.ResolverError('File Not Found or removed') # modified by mscreations. get the file url from the returned javascript match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) if match: return match.group( 1 ) + '|Referer=http%3A%2F%2Fwww.zalaa.com%2Fplayer%2Fplayer-embed.swf' else: raise UrlResolver.ResolverError('File Not Found or removed')
def get_media_url(self, host, media_id): vids = self.__get_Metadata(media_id) purged_jsonvars = {} lines = [] best = '0' for entry in vids['urls']: quality = self.__replaceQuality(entry['name']) lines.append(quality) purged_jsonvars[quality] = entry['url'] + '|' + urllib.urlencode(self.header) if int(quality) > int(best): best = quality if len(lines) == 1: return purged_jsonvars[lines[0]].encode('utf-8') else: if self.get_setting('auto_pick') == 'true': return purged_jsonvars[str(best)].encode('utf-8') else: result = xbmcgui.Dialog().select('Choose the link', lines) if result != -1: return purged_jsonvars[lines[result]].encode('utf-8') else: raise UrlResolver.ResolverError('No link selected') raise UrlResolver.ResolverError('No video found')
def get_media_url(self, host, media_id): if not self.get_setting('login') == 'true' or not ( self.get_setting('username') and self.get_setting('password')): raise UrlResolver.ResolverError( 'VeeHD requires a username & password') web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content # two possible playeriframe's: stream and download for match in re.finditer('playeriframe.+?src\s*:\s*"([^"]+)', html): player_url = 'http://%s%s' % (host, match.group(1)) html = self.net.http_GET(player_url).content # if the player html contains an iframe the iframe url has to be gotten and then the player_url tried again r = re.search('<iframe.*?src="([^"]+)', html) if r: frame_url = 'http://%s%s' % (host, r.group(1)) self.net.http_GET(frame_url) html = self.net.http_GET(player_url).content patterns = [ '"video/divx"\s+src="([^"]+)', '"url"\s*:\s*"([^"]+)', 'href="([^"]+(?:mp4|avi))' ] for pattern in patterns: r = re.search(pattern, html) if r: stream_url = urllib.unquote(r.group(1)) return stream_url raise UrlResolver.ResolverError('File Not Found or Removed')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content form_values = {} stream_url = None for i in re.finditer('<input type="hidden" name="(.*?)" value="(.*?)"', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(web_url, form_data=form_values).content r = re.search('<IFRAME SRC="(.*?)" .*?></IFRAME>', html, re.DOTALL) if r: html = self.net.http_GET(r.group(1)).content r = re.search("<div id=\"player_code\">.*?<script type='text/javascript'>(.*?)</script>", html, re.DOTALL) if not r: raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Player config not found.') r_temp = re.search("file: '([^']+)'", r.group(1)) if r_temp: stream_url = r_temp.group(1) else: js = jsunpack.unpack(r.group(1)) r = re.search("'file','([^']+)'", js.replace('\\', '')) if not r: r = re.search('"src"value="([^"]+)', js.replace('\\', '')) if not r: raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Filelink not found.') stream_url = r.group(1) if stream_url: return stream_url + '|User-Agent=%s' % (common.IE_USER_AGENT) else: raise UrlResolver.ResolverError('Unable to resolve link')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) #grab stream details html = self.net.http_GET(web_url).content html = unwise.unwise_process(html) filekey = unwise.resolve_var(html, "vars.key") error_url = None stream_url = None # try to resolve 3 times then give up for x in range(0, 2): link = self.__get_stream_url(media_id, filekey, error_num=x, error_url=error_url) if link: active = self.__is_stream_url_active(link) if active: stream_url = urllib.unquote(link) break else: # link inactive error_url = link else: # no link found raise UrlResolver.ResolverError('File Not Found or removed') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File Not Found or removed')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.SMU_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content default_url = self.__get_def_source(html) if default_url: qualities = self.__get_qualities(html) def_quality = self.__get_default(html) if len(qualities) <= 1: pick_quality = def_quality elif self.get_setting('auto_pick') == 'true': pick_quality = '' best_height = 0 for quality in qualities: height = int(quality[:-1]) if height > best_height: pick_quality = quality else: result = xbmcgui.Dialog().select('Choose the link', qualities) if result == -1: raise UrlResolver.ResolverError('No link selected') else: pick_quality = qualities[result] if not def_quality or pick_quality == def_quality: return default_url else: return default_url.replace('.mp4?', '-%s.mp4?' % (pick_quality)) else: raise UrlResolver.ResolverError('Unable to location download link')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) link = self.net.http_GET(web_url).content if link.find('Video Unavailable') >= 0: err_message = 'The requested video was not found.' raise UrlResolver.ResolverError(err_message) params = re.compile('"params","([\w\%\-\.\\\]+)').findall(link)[0] html = urllib.unquote(params.replace('\u0025', '%')).decode('utf-8') html = html.replace('\\', '') videoUrl = re.compile('(?:hd_src|sd_src)\":\"([\w\-\.\_\/\&\=\:\?]+)').findall(html) vUrl = '' vUrlsCount = len(videoUrl) if vUrlsCount > 0: q = self.get_setting('quality') if q == '0': # Highest Quality vUrl = videoUrl[0] else: # Standard Quality vUrl = videoUrl[vUrlsCount - 1] return vUrl else: raise UrlResolver.ResolverError('No playable video found.')
def get_media_url(self, host, media_id): dialog = xbmcgui.Dialog() url = 'https://real-debrid.com/ajax/unrestrict.php?link=%s' % media_id.replace( '|User-Agent=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0', '') source = self.net.http_GET(url).content jsonresult = json.loads(source) if 'generated_links' in jsonresult: generated_links = jsonresult['generated_links'] if len(generated_links) == 1: return generated_links[0][2].encode('utf-8') line = [] for link in generated_links: extension = link[0].split('.')[-1] line.append(extension.encode('utf-8')) result = dialog.select('Choose the link', line) if result != -1: link = generated_links[result][2] return link.encode('utf-8') else: raise UrlResolver.ResolverError('No generated_link') elif 'main_link' in jsonresult: return jsonresult['main_link'].encode('utf-8') else: if 'message' in jsonresult: raise UrlResolver.ResolverError( jsonresult['message'].encode('utf-8')) else: raise UrlResolver.ResolverError( 'No generated_link and no main_link')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) link = repr(self.net.http_GET(web_url).content) if link.find('404 Not Found') >= 0: raise UrlResolver.ResolverError('The requested video was not found.') videoUrl = [] # borrowed from AJ's turtle-x html = link.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '') sources = re.compile("{(.+?)}").findall(re.compile("sources (.+?)]").findall(html)[0]) for source in sources: video_link = str(re.compile('"file":"(.*?)"').findall(source)[0]) videoUrl.append(video_link) vUrl = '' vUrlsCount = len(videoUrl) if vUrlsCount > 0: q = self.get_setting('quality') if q == '0': # Highest Quality vUrl = videoUrl[0] elif q == '1': # Medium Quality vUrl = videoUrl[(int)(vUrlsCount / 2)] elif q == '2': # Lowest Quality vUrl = videoUrl[vUrlsCount - 1] return vUrl else: raise UrlResolver.ResolverError('No playable video found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) # get landing page html = self.net.http_GET(web_url, headers={'Referer': web_url}).content # read POST variables into data data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) if not r: raise UrlResolver.ResolverError('page structure changed') for name, value in r: data[name] = value # get delay from hoster; actually this is not needed, but we are polite delay = 5 r = re.search(r'var RequestWaiting = (\d+);', html) if r: delay = r.groups(1)[0] # run countdown and check whether it was canceld or not cnt = common.addon.show_countdown(int(delay), title='shared.sx', text='Please wait for hoster...') if not cnt: raise UrlResolver.ResolverError('countdown was canceld by user') # get video page using POST variables html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content # search for content tag r = re.search(r'class="stream-content" data-url', html) if not r: raise UrlResolver.ResolverError('page structure changed') # read the data-url r = re.findall(r'data-url="?(.+?)"', html) if not r: raise UrlResolver.ResolverError('video not found') # return media URL return r[0]
def get_media_url(self, host, media_id): base_url = self.get_url(host, media_id) soup = self.net.http_GET(base_url).content html = soup.decode('cp1251') vars_s = re.findall("""var vars = (.+)""", html) if vars_s: jsonvars = json.loads(vars_s[0]) purged_jsonvars = {} for item in jsonvars: if re.search('url[0-9]+', str(item)): purged_jsonvars[item] = jsonvars[item] lines = [] ls_url = [] best = '0' for item in purged_jsonvars: ls_url.append(item) quality = item.lstrip('url') lines.append(str(quality)) if int(quality) > int(best): best = quality if len(ls_url) == 1: return purged_jsonvars[ls_url[0]].encode('utf-8') else: if self.get_setting('auto_pick') == 'true': return purged_jsonvars['url%s' % (str(best))].encode( 'utf-8') + '|User-Agent=%s' % (common.IE_USER_AGENT) else: result = xbmcgui.Dialog().select('Choose the link', lines) if result != -1: return purged_jsonvars[ls_url[result]].encode( 'utf-8') + '|User-Agent=%s' % (common.IE_USER_AGENT) else: raise UrlResolver.ResolverError('No link selected') else: raise UrlResolver.ResolverError('No var_s found')
def get_media_url(self, host, media_id): url = self.get_url(host, media_id) common.addon.log_debug('HugeFiles - Requesting GET URL: %s' % url) html = self.net.http_GET(url).content if 'File Not Found' in html: raise UrlResolver.ResolverError('File Not Found or removed') #Set POST data values data = {} r = re.findall(r'type="hidden"\s+name="([^"]+)"\s+value="([^"]+)', html) if r: for name, value in r: data[name] = value else: raise UrlResolver.ResolverError('Cannot find data values') data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) common.addon.log_debug('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = self.net.http_POST(url, data).content r = re.search('fileUrl\s*=\s*"([^"]+)', html) if r: return r.group(1) raise UrlResolver.ResolverError('Unable to resolve HugeFiles Link')
def get_media_url(self, host, media_id): 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 html = self.net.http_POST(url, data).content r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) if r: fragment = r.group(1) stream_url = None for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): stream_url = match.group(1) if stream_url: stream_url = '%s?%s&direct=false' % (stream_url.split( '?')[0], urlparse.urlparse(stream_url).query) return stream_url + '|' + urllib.urlencode( {'User-Agent': common.IE_USER_AGENT}) else: raise UrlResolver.ResolverError('could not find file') else: raise UrlResolver.ResolverError('could not find sources')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url, headers={'Referer': web_url}).content data = {} r = re.findall(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html) if not r: raise UrlResolver.ResolverError('page structure changed') for name, value in r: data[name] = value html = self.net.http_POST(web_url, data, headers=({ 'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest' })).content r = re.search(r'class="stream-content" data-url', html) if not r: raise UrlResolver.ResolverError('page structure changed') r = re.findall(r'data-url="?(.+?)"', html) stream_url = r[0] + '|' + urllib.urlencode( {'User-Agent': common.IE_USER_AGENT}) return stream_url
def get_media_url(self, host, media_id): try: ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % ( media_id) result = self.net.http_GET(ticket_url).content js_result = json.loads(result) if js_result['status'] != 200: raise UrlResolver.ResolverError(js_result['msg']) video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % ( media_id, js_result['result']['ticket']) captcha_url = js_result['result'].get('captcha_url', None) if captcha_url: captcha_response = captcha_lib.get_response(captcha_url) if captcha_response: video_url += '&captcha_response=%s' % urllib.quote( captcha_response) xbmc.sleep(js_result['result']['wait_time'] * 1000) result = self.net.http_GET(video_url).content js_result = json.loads(result) if js_result['status'] != 200: raise UrlResolver.ResolverError(js_result['msg']) return js_result['result']['url'] + '?mime=true' except Exception as e: raise UrlResolver.ResolverError('Exception in openload: %s' % (e)) raise UrlResolver.ResolverError( 'Unable to resolve openload.io link. Filelink not found.')
def __get_link(self, url): headers = {'User-Agent': common.IE_USER_AGENT} common.addon.log_debug('180upload: get_link: %s' % (url)) html = self.net.http_GET(url, headers).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 UrlResolver.ResolverError('Unable to resolve link') # ignore captchas in embedded pages if 'embed' not in url: data.update(captcha_lib.do_captcha(html)) common.addon.log_debug( '180Upload - Requesting POST URL: %s with data: %s' % (url, data)) data['referer'] = url html = self.net.http_POST(url, data, headers).content # try download link link = re.search('id="lnk_download[^"]*" href="([^"]+)', html) stream_url = None if link: common.addon.log_debug('180Upload Download Found: %s' % link.group(1)) stream_url = 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)) stream_url = 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)) stream_url = link.group(1) if stream_url: return stream_url + '|User-Agent=%s&Referer=%s' % ( common.IE_USER_AGENT, url) else: raise UrlResolver.ResolverError('Unable to resolve link')
def get_media_url(self, host, media_id, retry=False): try: url = 'https://api.real-debrid.com/rest/1.0/unrestrict/link' headers = self.headers headers['Authorization'] = 'Bearer %s' % ( self.get_setting('token')) data = {'link': media_id} result = self.net.http_POST(url, form_data=data, headers=headers).content except urllib2.HTTPError as e: if not retry and e.code == 401: if self.get_setting('refresh'): self.refresh_token() return self.get_media_url(host, media_id, retry=True) else: self.set_setting('client_id', '') self.set_setting('client_secret', '') self.set_setting('token', '') raise UrlResolver.ResolverError( 'Real Debrid Auth Failed & No Refresh Token') else: try: js_result = json.loads(e.read()) if 'error' in js_result: msg = js_result['error'] else: msg = 'Unknown Error (1)' except: msg = 'Unknown Error (2)' raise UrlResolver.ResolverError('Real Debrid Error: %s (%s)' % (msg, e.code)) except Exception as e: raise UrlResolver.ResolverError( 'Unexpected Exception during RD Unrestrict: %s' % (e)) else: js_result = json.loads(result) links = [] link = self.__get_link(js_result) if link is not None: links.append(link) if 'alternative' in js_result: for alt in js_result['alternative']: link = self.__get_link(alt) if link is not None: links.append(link) if len(links) == 1 or self.get_setting('autopick') == 'true': return links[0][1] elif len(links) > 1: sd = xbmcgui.Dialog() ret = sd.select('Select a Link', [link[0] for link in links]) if ret > -1: return links[ret][1] else: raise UrlResolver.ResolverError( 'No usable link from Real Debrid')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if '404 Not Found' in html or 'Has Been Removed' in html: raise UrlResolver.ResolverError('The requested video was not found.') match = re.search('file\s*:\s*"([^"]+)', html) if match: return match.group(1) raise UrlResolver.ResolverError('No playable video found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.IE_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content if re.search('File was deleted', html): raise UrlResolver.ResolverError('File Not Found or removed') r = re.search("file: '([^']+)'", html) if not r: raise UrlResolver.ResolverError( 'Unable to resolve mrfile link. Filelink not found.') return r.group(1) + '|User-Agent=%s' % (common.IE_USER_AGENT)
def __get_link(self, url): headers = {'User-Agent': common.IE_USER_AGENT} common.addon.log_debug('HugeFiles: get_link: %s' % (url)) html = self.net.http_GET(url, headers).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 UrlResolver.ResolverError('Unable to resolve link') data.update(captcha_lib.do_captcha(html)) common.addon.log_debug( 'HugeFiles - Requesting POST URL: %s with data: %s' % (url, data)) data['referer'] = url html = self.net.http_POST(url, data, headers).content # try download link link = re.search('id="lnk_download[^"]*" href="([^"]+)', html) stream_url = None if link: common.addon.log_debug('HugeFiles Download Found: %s' % link.group(1)) stream_url = 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)) js = js.replace('\\', '') patterns = [ "name=[\"']src[\"']\s*value=['\"]([^'\"]+)", "['\"]file['\"]\s*,\s*['\"]([^'\"]+)", "<source[^>]+src=['\"]([^'\"]+)" ] for pattern in patterns: link = re.search(pattern, js) if link: common.addon.log_debug('Hugefiles Src Found: %s' % link.group(1)) stream_url = link.group(1) break if stream_url: return stream_url + '|User-Agent=%s&Referer=%s' % ( common.IE_USER_AGENT, url) else: raise UrlResolver.ResolverError('Unable to resolve link')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if '404 Not Found' in html: raise UrlResolver.ResolverError('The requested video was not found.') pattern = "file\s*:\s*'([^']+)'\s*,\s*'provider'\s*:\s*'http" match = re.search(pattern, html) if match: return match.group(1) raise UrlResolver.ResolverError('No video link found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if 'We are sorry!' in html: raise UrlResolver.ResolverError('File Not Found or Removed.') stream_url = self.__decode_O(html) if stream_url: return stream_url + '|User-Agent=%s' % (common.IE_USER_AGENT) raise UrlResolver.ResolverError( 'Unable to resolve openload.io link. Filelink not found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) link = self.net.http_GET(web_url).content if link.find('404 - Error') >= 0: raise UrlResolver.ResolverError( 'The requested video was not found.') video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0]) if len(video_link) > 0: return video_link else: raise UrlResolver.ResolverError('No playable video found.')
def getPlugins(): urlresolver.lazy_plugin_scan() resolvers = [] for resolver in UrlResolver.implementors(): resolvers.append(resolver) return resolvers