def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content r = re.search('data-config="(.*?)"', html) if r: rid = re.search('com/(\d*)/.*/(\d*)/', r.group(1)) rurl = 'https://cdn.video.playwire.com/%s/videos/%s/video-sd.mp4?hosting_id=%s' % \ (str(rid.group(1)), str(rid.group(2)), str(rid.group(1))) return rurl raise ResolverError('File Not Found or removed')
def __check_auth(self, media_id): try: js_data = self.__get_json(GET_URL.format(media_id=media_id)) except ResolverError as e: status, msg = e if status == 403: return else: raise ResolverError(msg) return js_data.get('result', {}).get('url')
def __check_auth(self, media_id): common.log_utils.log('Checking Auth: %s' % (media_id)) url = 'https://vidup.me/pair?file_code=%s&check' % (media_id) try: js_result = json.loads( self.net.http_GET(url, headers=self.headers).content) except ValueError: raise ResolverError('Unusable Authorization Response') common.log_utils.log('Auth Result: %s' % (js_result)) if js_result.get('status'): return js_result.get('response', {}).get('vt')
def refresh_token(self): client_id = self.get_setting('client_id') client_secret = self.get_setting('client_secret') refresh_token = self.get_setting('refresh') common.log_utils.log_debug( 'Refreshing Expired Real Debrid Token: |%s|%s|' % (client_id, refresh_token)) if not self.__get_token(client_id, client_secret, refresh_token): # empty all auth settings to force a re-auth on next use self.reset_authorization() raise ResolverError('Unable to Refresh Real Debrid Token')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content r = re.search('flashvars\.filekey="(.+?)"', html) if r: filekey = r.group(1) else: raise ResolverError("File Not Found or removed") api_call = "http://www.vidgg.to/api/player.api.php?{0}&file={1}&key={2}".format( "numOfErrors=0&cid=1&cid2=undefined&cid3=undefined&pass=undefined&user=undefined", media_id, urllib.quote_plus(filekey).replace(".", "%2E")) api_html = self.net.http_GET(api_call).content rapi = re.search("url=(.+?)&title=", api_html) if rapi: return rapi.group(1) raise ResolverError("File Not Found or removed")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'Referer': web_url, 'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content try: html = html.encode('utf-8') except: pass if "This video doesn't exist." in html: raise ResolverError('The requested video was not found.') match = re.search("split\('\|'\)\)\)\s*(.*?)</script>", html) if match: aa_text = aa_decoder.AADecoder(match.group(1)).decode() match = re.search("'([^']+)", aa_text) if match: stream_url = match.group(1) return stream_url + helpers.append_headers( {'User-Agent': common.FF_USER_AGENT}) raise ResolverError('Video Link Not 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 html = re.sub(r'[^\x00-\x7F]+', ' ', html) url_match = re.search('"weblink_get"\s*:\s*\[.+?"url"\s*:\s*"([^"]+)', html) tok_match = re.search('"tokens"\s*:\s*{\s*"download"\s*:\s*"([^"]+)', html) if url_match and tok_match: return '%s/%s?key=%s' % (url_match.group(1), media_id, tok_match.group(1)) raise 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 stream_url = re.compile('file *: *"(http.+?)"').findall(html) stream_url = [i for i in stream_url if not i.endswith('.srt')] if stream_url: return stream_url[-1] raise 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 match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) if match: stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) stream_url = [i for i in stream_url if not i.endswith('smil')] if stream_url: return stream_url[0] raise ResolverError('File Not Found or removed')
def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content url = re.findall("""filepath = '(.*)';""", html)[0] url = url[9:] url = base64.b64decode(url) if not url.startswith('aws'): url = url[1:] stream_url = 'http://%s' % url + helpers.append_headers( {'User-Agent': common.IE_USER_AGENT}) return stream_url except IndexError as e: if re.search( """<title>File not found or deleted - Teramixer</title>""", html): raise ResolverError('File not found or removed') else: raise ResolverError(e)
def get_media_url(self, host, media_id): net = common.Net() web_url = self.get_url(host, media_id) html = net.http_GET(web_url).content stream_url = re.compile('file\s*:\s*"(http.+?)"').findall(html) if stream_url: return stream_url[-1] + helpers.append_headers( {'User-Agent': common.FF_USER_AGENT}) raise 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 if 'was deleted' in html: raise ResolverError('File Removed') js_data = re.findall('(eval\(function.*?)</script>', html.replace('\n', '')) for i in js_data: try: html += jsunpack.unpack(i) except: pass link = re.search('file:"(.*?)",', html) if link: return link.group(1) raise ResolverError('Unable to find megamp4 video')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) response = self.net.http_GET(web_url) html = response.content if html: try: source = re.search('file:"(.*?)"', html).group(1) source = source + '|' + urllib.urlencode(self.header) '''headers = dict(response._response.info().items()) if 'set-cookie' in headers: cookie = urllib.urlencode({'Cookie': headers['set-cookie']}) source = '%s&%s' % (source, cookie)''' return source except: raise ResolverError('No playable video found.') else: raise ResolverError('No playable video found.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) resp = self.net.http_GET(web_url) html = resp.content r = re.search( "playlist:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*'(.+?)'", html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: raise ResolverError('no file located') return stream_url
def __get_Metadata(self, media_id): url = "http://www.ok.ru/dk?cmd=videoPlayerMetadata&mid=" + media_id html = self.net.http_GET(url, headers=self.header).content json_data = json.loads(html) if 'error' in json_data: raise ResolverError('File Not Found or removed') info = dict() info['urls'] = [] for entry in json_data['videos']: info['urls'].append(entry) return info
def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content data = helpers.get_hidden(html) 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 + helpers.append_headers( {'User-Agent': common.IE_USER_AGENT}) else: raise ResolverError('could not find file') else: raise ResolverError('could not find sources')
def get_media_url(self, host, media_id): username = self.get_setting('username') password = self.get_setting('password') url = 'http://api.zevera.com/jDownloader.ashx?' query = urllib.urlencode({ 'cmd': 'generatedownloaddirect', 'login': username, 'pass': password, 'olink': media_id }) url = url + query opener = urllib2.build_opener(NoRedirection) urllib2.install_opener(opener) redirs = 0 while redirs < MAX_REDIR: request = urllib2.Request(url) request.get_method = lambda: 'HEAD' try: response = urllib2.urlopen(request, timeout=TIMEOUT) if response.getcode() == 200: common.log_utils.log_debug('Zevera: Resolved to %s' % (url)) return url elif response.getcode() == 302: url = response.info().getheader('Location') redirs += 1 common.log_utils.log_debug('Zevera Redir #%d: %s' % (redirs, url)) else: common.log_utils.log_warning( 'Unexpected Zevera Response (%s): %s' % (response.getcode(), response.read())) raise ResolverError('Zevera: Unexpected Response Received') except socket.timeout: common.log_utils.log_warning('Zevera timeout: %s' % (url)) raise ResolverError('Zevera: Timeout') raise ResolverError('Zevera: Redirect beyond max allowed (%s)' % (MAX_REDIR))
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) print host print media_id response = self.net.http_GET(web_url) html = response.content if html: try: js_data = json.loads(html) sources = [(video['key'], video['url']) for video in js_data['videos']] sources = sources[::-1] source = helpers.pick_source(sources) source = source.encode('utf-8') return source + helpers.append_headers({'Cookie': response.get_headers(as_dict=True).get('Set-Cookie', '')}) except: raise ResolverError('No playable video found.') else: raise 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 r = re.search('<a[^>]*id="go-next"[^>*]href="([^"]+)', html) if r: next_url = 'http://' + host + r.group(1) html = self.net.http_GET(next_url, headers=headers).content if 'file you were looking for could not be found' in html: raise ResolverError('File Not Found or removed') r = re.search("var\s+lnk\d+\s*=\s*'(.*?)'", html) if r: stream_url = r.group(1) stream_url = urllib2.urlopen( urllib2.Request(stream_url, headers=headers)).geturl() stream_url = stream_url + '|' + urllib.urlencode(headers) return stream_url else: raise ResolverError('Unable to locate link')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) resp = self.net.http_GET(web_url) html = resp.content post_url = resp.get_url() form_values = helpers.get_hidden(html) html = self.net.http_POST(post_url, form_data=form_values).content r = re.search('file: "http(.+?)"', html) if r: return "http" + r.group(1) else: raise ResolverError('Unable to resolve Movpod 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 ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search('(eval\(function.*?)\s*</script>', html, re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) else: js = html link = re.search('sources[\d\D]+(http.*?)",label', js) if link: common.log_utils.log_debug('fastplay.sx Link Found: %s' % link.group(1)) return link.group(1) raise ResolverError('Unable to find fastplay.sx video')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.IOS_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content r = re.search('file\s*:\s*"(http.+?)"', html) if r: return r.group(1) else: raise ResolverError("File Link Not Found")
def get_media_url(url): try: headers = {'User-Agent': common.FF_USER_AGENT} html = net.http_GET(url, headers=headers).content.encode('utf-8') decodes = [AADecoder(match.group(1)).decode() for match in re.finditer('<script[^>]+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)] if not decodes: raise ResolverError('No Encoded Section Found. Deleted?') common.log_utils.log(decodes) enc_index = 0 for text in decodes: match = re.search('welikekodi_ya_rly\s*=\s*(.*?)([0-9/\*\-\+ ]+)', text) if match: enc_index = eval(match.group(2)) if 'round' in match.group(1): enc_index = int(round(enc_index)) common.log_utils.log('chosen encode: %s' % (decodes[enc_index])) match = re.search('window\..+?=(.*?);', decodes[enc_index]) if not match: match = re.search('.*attr\(\"href\",\((.*)', decodes[enc_index]) if match: common.log_utils.log('to conv: %s' % (match.group(1))) dtext = conv(match.group(1)) dtext = dtext.replace('https', 'http') request = urllib2.Request(dtext, None, headers) response = urllib2.urlopen(request) url = response.geturl() response.close() url += '|' + urllib.urlencode({'Referer': url, 'User-Agent': common.IOS_USER_AGENT}) return url except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise raise 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) html = self.net.http_GET(web_url).content if 'Not Found' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) if match: sources = eval( match.group(1).replace('file', '"file"').replace('label', '"label"')) if 'label' not in sources[0]: sources[0]['label'] = 'HLS' sources = [(s['label'], s['file']) for s in sources] return helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') raise ResolverError('Unable to find %s video' % (host))
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 'Not Found' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search('(eval\(function.*?)\s*</script>', html, re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) else: js = html link = re.search('file\s*:\s*"([^"]+)', js) if link: #common.log_utils.log_debug('letwatch.us Link Found: %s' % link.group(1)) return link.group(1) raise ResolverError('Unable to find letwatch.us video')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content match = re.search('file\s*:\s*["\']([^"\']+)', html) if not match: raise ResolverError('File Not Found or removed') else: source = match.group(1) html = self.net.http_GET(source).content html = html.replace('\n', '') sources = re.findall('RESOLUTION\s*=\s*([^,]+).+?(http[^\#]+)', html) sources.sort(key=lambda x: int(x[0].split('x')[0]), reverse=True) if not sources: raise ResolverError('File Not Found or removed') else: return helpers.pick_source(sources) + helpers.append_headers( headers)
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 re.search('>File not found!<', html): raise ResolverError('File Not Found or removed') web_url = 'http://www.ecostream.tv/js/ecoss.js' js = self.net.http_GET(web_url).content r = re.search("\$\.post\('([^']+)'[^;]+'#auth'\).html\(''\)", js) if not r: raise ResolverError('Posturl not found') post_url = r.group(1) r = re.search('data\("tpm",([^\)]+)\);', js) if not r: raise ResolverError('Postparameterparts not found') post_param_parts = r.group(1).split('+') found_parts = [] for part in post_param_parts: pattern = "%s='([^']+)'" % part.strip() r = re.search(pattern, html) if not r: raise ResolverError('Formvaluepart not found') found_parts.append(r.group(1)) tpm = ''.join(found_parts) # emulate click on button "Start Stream" headers = ({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': common.IE_USER_AGENT}) web_url = 'http://www.ecostream.tv' + post_url html = self.net.http_POST(web_url, {'id': media_id, 'tpm': tpm}, headers=headers).content sPattern = '"url":"([^"]+)"' r = re.search(sPattern, html) if not r: raise ResolverError('Unable to resolve Ecostream link. Filelink not found.') stream_url = 'http://www.ecostream.tv' + r.group(1) stream_url = urllib2.unquote(stream_url) stream_url = urllib2.urlopen(urllib2.Request(stream_url, headers=headers)).geturl() return stream_url
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 = helpers.get_hidden(html) print data 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 ResolverError('page structure changed') r = re.findall(r'data-url="?(.+?)"', html) stream_url = r[0] + helpers.append_headers({'User-Agent': common.IE_USER_AGENT}) return stream_url
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': 'abc'}).content if 'File was deleted' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search('(eval\(function.*?)\s*</script>', html, re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) else: js = html link = re.search('([^"]*.mp4)', js) if link: common.log_utils.log_debug('vidfile.xyz Link Found: %s' % link.group(1)) return link.group(1) raise ResolverError('Unable to find vidfile.xyz video')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content sources = re.findall('type:"video/mp4",src:"([^"]+)"', html) if sources: source = sources[0] if not 'http' in source: source = 'https:' + source return source + helpers.append_headers( {'User-Agent': common.IE_USER_AGENT}) else: raise ResolverError('File Not Found or removed')