def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) response, video_urls = self._parse_google(web_url) if video_urls: video_urls.sort(key=self.__key, reverse=True) video = helpers.pick_source(video_urls) else: video = None if response is not None: res_headers = response.get_headers(as_dict=True) if 'Set-Cookie' in res_headers: self.headers['Cookie'] = res_headers['Set-Cookie'] if not video: if any(url_match in web_url for url_match in self.url_matches): video = self._parse_redirect(web_url, hdrs=self.headers) elif 'googlevideo.' in web_url: video = web_url + helpers.append_headers(self.headers) else: if any(url_match in video for url_match in self.url_matches): video = self._parse_redirect(video, hdrs=self.headers) if video: if 'plugin://' in video: # google plus embedded videos may result in this return video else: return video + helpers.append_headers(self.headers) raise ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) response, video_urls = self._parse_google(web_url) if video_urls: video = helpers.pick_source(video_urls, self.get_setting('auto_pick') == 'true') else: video = None headers = {'User-Agent': common.FF_USER_AGENT} if response is not None: res_headers = response.get_headers(as_dict=True) if 'Set-Cookie' in res_headers: headers['Cookie'] = res_headers['Set-Cookie'] if not video: if ('redirector.' in web_url) or ('googleusercontent' in web_url): video = urllib2.urlopen(web_url).geturl() elif 'googlevideo.' in web_url: video = web_url + helpers.append_headers(headers) else: if ('redirector.' in video) or ('googleusercontent' in video): video = urllib2.urlopen(video).geturl() if video: if 'plugin://' in video: # google plus embedded videos may result in this return video else: return video + helpers.append_headers(headers) raise ResolverError('File not found')
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} player_headers = {'Cookie': 'PHPSESSID=1', 'Referer': 'http://static.cda.pl/flowplayer/flash/flowplayer.commercial-3.2.18.swf'} player_headers.update(headers) html = self.net.http_GET(web_url, headers=headers).content try: html = html.encode('utf-8') except: pass match = re.findall('data-quality="(.*?)" href="(.*?)".*?>(.*?)</a>', html, re.DOTALL) if match: mylinks = sorted(match, key=lambda x: x[2]) html = self.net.http_GET(mylinks[-1][1], headers=headers).content from HTMLParser import HTMLParser match = re.search('''['"]file['"]:\s*['"](.+?)['"]''', HTMLParser().unescape(html)) if match: mylink = match.group(1).replace("\\", "") return self.__check_vid(mylink) + helpers.append_headers(player_headers) html = jsunpack.unpack(re.search("eval(.*?)\{\}\)\)", html, re.DOTALL).group(1)) match = re.search('src="(.*?\.mp4)"', html) if match: return self.__check_vid(match.group(1)) + helpers.append_headers(player_headers) raise ResolverError('Video Link Not Found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) response, video_urls = self._parse_google(web_url) if video_urls: video_urls.sort(key=self.__key, reverse=True) video = helpers.pick_source(video_urls) else: video = None headers = {'User-Agent': common.FF_USER_AGENT} if response is not None: res_headers = response.get_headers(as_dict=True) if 'Set-Cookie' in res_headers: headers['Cookie'] = res_headers['Set-Cookie'] if not video: if ('redirector.' in web_url) or ('googleusercontent' in web_url): class NoRedirection(urllib2.HTTPErrorProcessor): def http_response(self, request, response): return response https_response = http_response opener = urllib2.build_opener(NoRedirection) opener = urllib2.install_opener(opener) request = urllib2.Request(web_url, headers=headers) response = urllib2.urlopen(request) response_headers = dict([(item[0].title(), item[1]) for item in response.info().items()]) cookie = response_headers.get('Set-Cookie', None) if cookie: headers.update({'Cookie': cookie}) video = response.geturl() elif 'googlevideo.' in web_url: video = web_url + helpers.append_headers(headers) else: if ('redirector.' in video) or ('googleusercontent' in video): class NoRedirection(urllib2.HTTPErrorProcessor): def http_response(self, request, response): return response https_response = http_response opener = urllib2.build_opener(NoRedirection) opener = urllib2.install_opener(opener) request = urllib2.Request(video, headers=headers) response = urllib2.urlopen(request) response_headers = dict([(item[0].title(), item[1]) for item in response.info().items()]) cookie = response_headers.get('Set-Cookie', None) if cookie: headers.update({'Cookie': cookie}) video = response.geturl() if video: if 'plugin://' in video: # google plus embedded videos may result in this return video else: return video + helpers.append_headers(headers) raise ResolverError('File not found')
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 if html: srcs = re.findall(r'href="(%s&q=[^"]+)' % web_url, html, re.I) if srcs: sources = [] for src in srcs: shtml = self.net.http_GET(src, headers=headers).content strurl = helpers.parse_html5_source_list(shtml) if strurl: sources.append(strurl[0]) if len(sources) > 1: try: sources.sort(key=lambda x: int(re.sub("\D", "", x[0])), reverse=True) except: common.logger.log_debug('Scrape sources sort failed |int(re.sub("\D", "", x[0])|') try: sources.sort(key=lambda x: re.sub("[^a-zA-Z]", "", x[0])) except: common.logger.log_debug('Scrape sources sort failed |re.sub("[^a-zA-Z]", "", x[0])|') else: sources = helpers.parse_html5_source_list(html) return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError("Video not found")
def get_media_url(url, media_id): headers = {'User-Agent': common.RAND_UA} html = net.http_GET(url, headers=headers).content if html: html = html.encode('utf-8') aa_text = re.findall("""(゚ω゚ノ\s*=\s*/`m´\s*)\s*ノ.+?)</SCRIPT>""", html, re.I) if aa_text: try: aa_decoded = '' for i in aa_text: try: aa_decoded += str(aadecode.decode(re.sub('\(+゚Д゚\)+\s*\[゚o゚\]\)*\s*\+(.+?)\(+゚Д゚\s*\)+\[゚o゚\]\)+', r'(゚Д゚)[゚o゚]+\1(゚Д゚)[゚o゚])', i))) except: pass href = re.search("""\.location\s*=\s*['"]\/([^"']+)""", aa_decoded) if href: href = href.group(1) if href.startswith("http"): location = href elif href.startswith("//"): location = "http:%s" % href else: location = "http://www.speedvid.net/%s" % href headers.update({'Referer': url, 'Cookie': str((int(math.floor((900-100)*random())+100))*(int(time.time()))*(128/8))}) _html = net.http_GET(location, headers=headers).content sources = helpers.scrape_sources(_html, patterns=['''file\s*:\s*.["'](?P<url>(?=http://s(?:02|06))[^"']+)''']) if sources: del headers['Cookie'] headers.update({'Referer': location}) return helpers.pick_source(sources) + helpers.append_headers(headers) except Exception as e: raise ResolverError(e) raise ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) referer = 'https://flixtor.to/watch/%s' % media_id headers = {'User-Agent': common.RAND_UA} response = self.net.http_GET(referer, headers=headers) response_headers = response.get_headers(as_dict=True) headers.update({'Referer': referer}) cookie = response_headers.get('Set-Cookie', None) if cookie: headers.update({'Cookie': cookie.replace('HttpOnly, ', '')}) html = self.net.http_GET(web_url, headers=headers).content if html: try: html = base64.b64decode(html.decode("rot13")) l_ = [] for c_ in html: k_ = ord(c_) t_ = chr(33 + (k_ + 14) % 94) if 33 <= k_ <= 126 else chr(k_) l_.append(t_) html = ''.join(l_) html = json.loads(html) except Exception as e: raise ResolverError(e) source = html.get("file", None) if source: return source + helpers.append_headers(headers) raise ResolverError("Unable to locate video")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} try: html = self.net.http_GET(web_url, headers=headers).content except urllib2.HTTPError as e: if e.code == 404: raise ResolverError("Video not found") srcs = re.findall(r'href="(%s&q=[^"]+)' % web_url, html, re.I) if srcs: sources = [] for src in srcs: shtml = self.net.http_GET(src, headers=headers).content strurl = helpers.parse_html5_source_list(shtml) if strurl: sources.append(strurl[0]) sources = helpers.sort_sources_list(sources) else: sources = helpers.parse_html5_source_list(html) if len(sources) > 0: return helpers.pick_source(sources) + helpers.append_headers(headers) else: raise ResolverError("Video not found")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url.replace("iframe-", "preview-")} html = self.net.http_GET(web_url, headers=headers).content if html: sources = helpers.scrape_sources(html, patterns=['''src\s*:\s*["'](?P<url>[^"']+)''']) data = re.findall("""_[^=]+=\[([^\]]+)\];""", html, re.DOTALL) if sources and data: data = data[3].replace('\\x', '').split(",") data = [x.replace('"', '').replace(' ', '').decode("hex") for x in data] key = "".join(data[7:9]) if key.startswith("embed"): key = key[6:]+key[:6] i = 0 headers.update({'Referer': web_url}) for source in sources: try: src = urlparse.urlparse(source[1]) l = list(src) b = l[2].split("/")[1:] b[0] = self.decrypt(b[0], key) l[2] = "/".join(b) sources[i] = (source[0], urlparse.urlunparse(l)) i += 1 except: i += 1 return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError('File not found')
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('''<source[^>]+src=["']([^'"]+)[^>]+type=['"]video''', html) if match: return match.group(1) + helpers.append_headers({'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}) match = re.search('''{\s*file\s*:\s*['"]([^'"]+)''', html, re.DOTALL) if not match: match = re.search('''href="([^"]+)[^>]+>\(download\)''', html, re.DOTALL) if match: return match.group(1) + helpers.append_headers({'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}) raise ResolverError('Unable to resolve weshare 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 try: r = re.search('flashvars.filekey=(.+?);', html) if r is None: raise Exception() r = r.group(1) try: filekey = re.compile('\s+%s="(.+?)"' % r).findall(html)[-1] except: filekey = r player_url = 'http://www.auroravid.to/api/player.api.php?key=%s&file=%s' % (filekey, media_id) html = self.net.http_GET(player_url).content r = re.search('url=(.+?)&', html) if r: stream_url = r.group(1) return stream_url except: sources = helpers.parse_html5_source_list(html) source = helpers.pick_source(sources) return source + helpers.append_headers({'User-Agent': common.FF_USER_AGENT}) raise ResolverError('File Not Found or removed')
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') vBlocks = re.findall('{(file.*?label.*?)}', html) html5 = re.findall('}\((.*?)\)\)<', html) if not vBlocks and not html5: raise ResolverError('No vsource found') data = {} data['purged_jsonvars'] = {} data['lines'] = [] if html5: for source in html5: params = source.split(',') data = self.__decodeLinks(params[0], params[3].split('|'), data) elif vBlocks: data = self.__getFlashVids() sources = [(line, data['purged_jsonvars'][line]) for line in data['lines']] try: sources.sort(key=lambda x: int(x[0][3:]), reverse=True) except: pass source = helpers.pick_source(sources) return source + helpers.append_headers({'User-Agent': common.IE_USER_AGENT})
def get_media_url(self, host, media_id): headers = { 'User-Agent': common.IE_USER_AGENT } query = urlparse.parse_qs(media_id) try: oid, video_id = query['oid'][0], query['id'][0] except: oid, video_id = re.findall('(.*)_(.*)', media_id)[0] try: hash = query['hash'][0] except: hash = self.__get_hash(oid, video_id) api_url = 'http://api.vk.com/method/video.getEmbed?oid=%s&video_id=%s&embed_hash=%s' % (oid, video_id, hash) html = self.net.http_GET(api_url).content html = re.sub(r'[^\x00-\x7F]+', ' ', html) try: result = json.loads(html)['response'] except: result = self.__get_private(oid, video_id) sources = [(key[3:], result[key]) for key in result if re.match('url\d+', key)] try: sources.sort(key=lambda x: int(x[0]), reverse=True) except: pass source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') return source + helpers.append_headers(headers) raise ResolverError('No 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 try: stream_url = '' r = re.search('flashvars.filekey=(.+?);', html) if r: r = r.group(1) try: filekey = re.search('var\s+%s\s*=\s*"([^"]+)' % (r), html).group(1) except: filekey = r player_url = 'http://%s/api/player.api.php?key=%s&file=%s' % (host, urllib.quote(filekey), media_id) html = self.net.http_GET(player_url).content r = re.search('url=(.+?)&', html) if r: stream_url = r.group(1) except: common.log_utils.log("no embedded urls found using first method") try: r = re.search('id="player"[^>]+src="([^"]+)', html, re.DOTALL) if r: stream_url = r.group(1) except: print "no embedded urls found using second method" if stream_url: return stream_url + helpers.append_headers({'Referer': web_url}) else: raise 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.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: file_id = re.search("file_id',\s*'([^']+)",html) if file_id: headers.update({'cookie': 'lang=1; file_id={}'.format(file_id.group(1))}) html = self.net.http_GET(web_url, headers=headers).content else: html = None if html: html = html.encode('utf-8') aa_text = re.search("""(゚ω゚ノ\s*=\s*/`m´\s*)\s*ノ.+?;)\svar""", html, re.I) if aa_text: try: aa_decoded = str(aadecode.decode(aa_text.group(1))) except: raise ResolverError('Error decoding') sources = helpers.scrape_sources(aa_decoded) if sources: headers.update({'Referer': web_url}) return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError('Video not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content sources = self.__parse_sources_list(html) source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') return source + helpers.append_headers(headers)
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 if html: try: purl = re.compile('data-src="(.+?)"', re.DOTALL).search(html) purl = purl.group(1) purl = 'http:' + purl.replace('&', '&') html = self.net.http_GET(purl, headers=headers).content purl = re.compile('<link rel="alternate" href=".+?<link rel="alternate" href="(.+?)"', re.DOTALL).search(html).group(1) purl += '&format=Script&height=576&width=1024' html = self.net.http_GET(purl, headers=headers).content a = json.loads(html) url = a["captions"][0]["src"] url = url.split('/caption/',1)[1] url_snippit = url.split('.',1)[0] url_template = 'https://tvesyfy-vh.akamaihd.net/i/prod/video/%s_,25,40,18,12,7,4,2,00.mp4.csmil/master.m3u8?__b__=1000&hdnea=st=%s~exp=%s' curr_time = (datetime.datetime.utcnow()- datetime.datetime(1970,1,1)) start_time = int((curr_time.microseconds + (curr_time.seconds + curr_time.days * 24 * 3600) * 10**6) / 10**6) resolved_url = url_template % (url_snippit, str(start_time), str(start_time+60)) headers.update({'Referer': web_url}) return resolved_url + helpers.append_headers(headers) except: raise ResolverError('Video not found') raise ResolverError('Video 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, headers=self.headers).content """if '"reason":"video attribute|explicit"' in html: headers = {'Referer': web_url} headers.update(self.headers) url_back = '/embed/video/%s' % (media_id) web_url = 'http://www.dailymotion.com/family_filter?enable=false&urlback=%s' % (urllib.quote_plus(url_back)) html = self.net.http_GET(url=web_url, headers=headers).content""" if '"title":"Content rejected."' in html: raise ResolverError('This video has been removed due to a copyright claim.') match = re.search('var\s+config\s*=\s*(.*?}});', html) if not match: raise ResolverError('Unable to locate config') try: js_data = json.loads(match.group(1)) except: js_data = {} sources = [] streams = js_data.get('metadata', {}).get('qualities', {}) for quality, links in streams.iteritems(): for link in links: if quality.isdigit() and link.get('type', '').startswith('video'): sources.append((quality, link['url'])) sources.sort(key=lambda x: self.__key(x), reverse=True) return helpers.pick_source(sources) + helpers.append_headers(self.headers)
def __box_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'not available in your country' in html: msg = 'Unavailable in your country' common.kodi.notify(header=None, msg=msg, duration=3000) raise ResolverError(msg) elif re.search('''You need to be a <a.+?>premium member''', html): msg = 'Premium membership required' common.kodi.notify(header=None, msg=msg, duration=3000) raise ResolverError(msg) r = re.search('or you can wait ((?:\d hour,\s*)?(?:\d+ minutes?,\s*)?\d+ seconds?)', html, re.I) if r: msg = 'Cooldown in effect, %s remaining' % r.group(1) common.kodi.notify(header=None, msg=msg, duration=3000) raise ResolverError(msg) data = helpers.get_hidden(html) for _ in range(0, 3): html = self.net.http_POST(web_url, data, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') match = re.search('''href\s*=\s*['"]([^'"]+)[^>]+>\s*<span[^>]+class\s*=\s*['"]button_upload green['"]''', html) if match: stream_url = match.group(1) return stream_url.replace(' ', '%20') + helpers.append_headers(self.headers) else: common.kodi.sleep(1000)
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 stream_url = '' match = re.search('<video.*?</video>', html, re.DOTALL) if match: links = re.findall('<source[^>]+src="([^"]+)', match.group(0), re.DOTALL) if links: stream_url = random.choice(links) if not stream_url: match = re.search('fkzd="([^"]+)', html) if match: query = {'pass': '******', 'key': match.group(1), 'cid3': 'undefined', 'cid': 0, 'numOfErrors': 0, 'file': media_id, 'cid2': 'undefined', 'user': '******'} api_url = 'http://www.wholecloud.net//api/player.api.php?' + urllib.urlencode(query) html = self.net.http_GET(api_url, headers=headers).content match = re.search('url=([^&]+)', html) if match: stream_url = match.group(1) if stream_url: headers.update({'Referer': web_url, }) return stream_url + helpers.append_headers(headers) else: raise ResolverError('File Not Found or removed')
def __get_def_source(self, html): default_url = '' match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) if match: match = re.search('src\s*:\s*"([^"]+)', match.group(1)) if match: default_url = match.group(1) + helpers.append_headers(self.headers) return default_url
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': 'https://waaw.tv/watch_video.php?v=%s&post=1' % media_id} html = self.net.http_GET(web_url, headers=headers).content if html: try: wise = re.search('(eval\s*\(function.*?)</script>', html, re.DOTALL | re.I).groups()[0] data_unwise = self.jswise(wise).replace("\\", "") try: at = re.search('var at\s*=\s*"([^"]+)"', data_unwise, re.I).groups()[0] except: at = "" try: http_referer = re.search('var http_referer\s*=\s*"([^"]+)"', data_unwise, re.I).groups()[0] except: http_referer = "" player_url = "http://hqq.watch/sec/player/embed_player.php?iss=&vid=%s&at=%s&autoplayed=yes&referer=on&http_referer=%s&pass=&embed_from=&need_captcha=0&hash_from=" % (media_id, at, http_referer) headers.update({'Referer': web_url}) data_player = self.net.http_GET(player_url, headers=headers).content data_unescape = re.findall('document.write\(unescape\("([^"]+)"', data_player) data = "" for d in data_unescape: data += urllib.unquote(d) data_unwise_player = "" wise = "" wise = re.search('(eval\s*\(function.*?)</script>', data_player, re.DOTALL | re.I) if wise: data_unwise_player = self.jswise(wise.group(1)).replace("\\", "") try: vars_data = re.search('/player/get_md5.php",\s*\{(.*?)\}', data, re.DOTALL | re.I).groups()[0] except: vars_data = "" matches = re.findall('\s*([^:]+):\s*([^,]*)[,"]', vars_data) params = {} for key, value in matches: if key == "adb": params[key] = "0/" elif '"' in value: params[key] = value.replace('"', '') else: try: value_var = re.search('var\s*%s\s*=\s*"([^"]+)"' % value, data, re.I).groups()[0] except: value_var = "" if not value_var and data_unwise_player: try: value_var = re.search('var\s*%s\s*=\s*"([^"]+)"' % value, data_unwise_player, re.I).groups()[0] except: value_var = "" params[key] = value_var params = urllib.urlencode(params) headers.update({'X-Requested-With': 'XMLHttpRequest', 'Referer': player_url}) data= "" data = self.net.http_GET("http://hqq.watch/player/get_md5.php?" + params, headers=headers).content url_data = json.loads(data) media_url = self.tb(url_data["html5_file"].replace("#", "")) del headers["Referer"] if media_url: return media_url + helpers.append_headers(headers) except Exception as e: raise ResolverError(e) raise ResolverError('Video 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 for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) r = re.search('src="([^"]+)', js_data) if r: stream_url = r.group(1).replace(' ', '%20') stream_url += helpers.append_headers({'Referer': web_url}) return stream_url match = re.search("'file'\s*,\s*'([^']+)", html) if match: stream_url = match.group(1).replace(' ', '%20') stream_url += helpers.append_headers({'Referer': web_url}) return stream_url raise 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.IE_USER_AGENT, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content url = re.findall('src\s*:\s*\'(.+?)\'', html) if url: return url[-1] + helpers.append_headers(headers) else: raise ResolverError('File not found')
def get_media_url(self, host, media_id): result = self.__check_auth(media_id) if not result: result = self.__auth_ip(media_id) if result: return helpers.pick_source(result.items()) + helpers.append_headers(self.headers) raise ResolverError(i18n('no_ip_authorization'))
def __get_def_source(self, html): default_url = '' match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) common.log_utils.log(match) if match: match = re.search('"(https://.*?[^"])"', match.group(1)) if match: default_url = match.group(1) + helpers.append_headers(self.headers) return default_url
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content data = helpers.get_hidden(html) headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') html = self.net.http_POST(response.get_url(), headers=headers, form_data=data).content sources = helpers.scrape_sources(html) 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) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: quals = re.findall("""href=["'].+?id=["'](\d{3,4})p""", html) source = re.search("""mp4\d+\s*=\s*["']([^"']+)""", html) if source: headers.update({'Referer': web_url}) if len(quals) > 1: sources = [(qual, re.sub('-\d{3,4}\.', '-%s.' % qual, source.group(1))) for qual in quals] try: sources.sort(key=lambda x: int(re.sub("\D", "", x[0])), reverse=True) except: common.logger.log_debug('Scrape sources sort failed |int(re.sub("\D", "", x[0])|') return helpers.pick_source(sources) + helpers.append_headers(headers) else: return source.group(1) + helpers.append_headers(headers) raise ResolverError('Unable to locate video')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content if 'Not Found' in html: raise ResolverError('File Removed') headers['Referer'] = web_url stream_url = re.findall('source src="([^"]+)', html)[0] return stream_url + helpers.append_headers(headers)
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 file_id = re.findall("'file_id', '(\d+)',", html)[0] headers = {'X-Requested-With': "XMLHttpRequest", 'Referer': web_url} if html: video_url = None js = html packed = re.search('(eval\(function.*?)\s*</script>', html, re.DOTALL) if packed: js1 = jsunpack.unpack(packed.group(1)) else: js1 = html video_url = None link = re.search("(/dl\?op=view&file_code=[^']+)", js1) if link: #$.cookie('file_id', '1675923', {expires: 10}); headers['Cookie'] = {'file_id':file_id} response = self.net.http_GET('https://%s%s'% (host,link.group(1)) , headers=headers).content common.log_utils.log_debug('to Link Found: %s' % video_url) headers = {'Referer': web_url} if video_url == None: link = re.search('(http[^"]*.mp4)', js) if link: video_url = link.group(1) common.log_utils.log_debug('watchers.to Link Found: %s' % video_url) if video_url != None: return video_url+ helpers.append_headers(headers) else: raise ResolverError('No playable video found.') return helpers.get_media_url(self.get_url(host, media_id)) + helpers.append_headers(headers)
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if 'File not found, sorry!' not in html: sources = helpers.scrape_sources(html) if sources: return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError("Video not found")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content sources = helpers.scrape_sources(html) if sources: return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('Video cannot be located.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content if 'video has been removed' not in html: source = re.findall('hls:"([^"]+)', html)[0] return source + 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) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content r = re.search('file:"([^"]+m3u8)"', html) if r: return r.group(1) + helpers.append_headers(headers) raise ResolverError('Video cannot be located.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content match = re.search('data="([^"]+)', html) if match: data = json.loads(match.group(1).replace('"', '"')) src = data.get('streams').get('0').get('src') return self.easyload_decode(src, '15') + helpers.append_headers(headers) raise ResolverError('Video Link Not Found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content r = re.search(r'<video\s*id="player"[^>]+data-stream="([^"]+)', html) if r: return r.group(1).decode('base64') + helpers.append_headers( headers) raise ResolverError('Video cannot be located.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': 'https://www.mehlizmovieshd.com/'} html = self.net.http_GET(web_url, headers=headers).content if html: sources = helpers.parse_sources_list(html) if sources: sources = helpers.sort_sources_list(sources) return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError('Video not found')
def get_media_url(self, host, media_id): try: result = self.__check_auth(media_id) if not result: result = self.__auth_ip(media_id) except ResolverError: raise if result: return helpers.pick_source(result) + helpers.append_headers(self.headers) raise ResolverError("Unable to retrieve video")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'verifypeer': 'False'} html = self.net.http_GET(web_url, headers=headers).content if html: html += helpers.get_packed_data(html) source = re.search(r'''sources\s*:\s*\["([^"]+)''', html) if source: return source.group(1) + helpers.append_headers(headers) raise ResolverError("Video not found")
def get_media_url(self, host, media_id): web_url = "http://video.sibnet.ru/shell_config_xml.php?videoid=%s&partner=null&playlist_position=null&playlist_size=0&related_albid=0&related_tagid=0&related_ids=null&repeat=null&nocache" % ( media_id) headers = { 'User-Agent': """"Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; androVM for VirtualBox ('Tablet' version with phone caps) Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30""", 'Referer': web_url } html = self.net.http_GET(web_url, headers=headers).content video = re.findall("""(https:\/\/video\.sibnet\.ru\/v\/.*.mp4)""", html)[0] return video + helpers.append_headers(headers)
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) response = self.net.http_GET(web_url, headers=self.headers) sources = helpers.scrape_sources( response.content, patterns=[r'''source src=['"](?P<url>https.+?\.mp4)['"] type=['"]video/mp4['"]'''] ) self.headers.update({'Referer': web_url}) return helpers.pick_source(sources) + helpers.append_headers(self.headers)
def get_media_url(self, host, media_id): vids = self.__get_Metadata(media_id) sources = [] for entry in vids['urls']: quality = self.__replaceQuality(entry['name']) sources.append((quality, entry['url'])) try: sources.sort(key=lambda x: int(x[0]), reverse=True) except: pass source = helpers.pick_source(sources) source = source.encode('utf-8') + helpers.append_headers(self.header) return source
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content data = helpers.get_hidden(html) headers['Cookie'] = response.get_headers(as_dict=True).get( 'Set-Cookie', '') html = self.net.http_POST(web_url, headers=headers, form_data=data).content sources = helpers.scrape_sources(html, result_blacklist='tmp') 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) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: sources = helpers.scrape_sources(html) if sources: headers.update({'Referer': web_url, 'Range': 'bytes=0-'}) return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError('Video not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content r = re.search("text/javascript'>(eval.*?)\s*</script>", html, re.DOTALL) if r: html = jsunpack.unpack(r.group(1)) src = re.search('file:"([^"]+)"', html) if src: return src.group(1) + helpers.append_headers(headers) raise ResolverError('Video cannot be located.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': 'https://www1.putlockertv.se/'} html = self.net.http_GET(web_url, headers=headers).content if html: sources = helpers.scrape_sources(html) if sources: headers.update({'Referer': web_url}) return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError("Unable to locate video")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content sources = re.findall( '''['"]?url['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', html) if sources: print "S", sources[-1][0].replace('\\', '') return sources[-1][0].replace('\\', '') return helpers.pick_source(sources) + helpers.append_headers(headers)
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) headers = {'Referer': 'onlystream.tv', 'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content r = re.search('sources: .{file:"(.+?)"', html, re.DOTALL) headers = { 'Referer': 'https://onlystream.tv/' + media_id, 'User-Agent': common.RAND_UA } if r: return r.group(1) + helpers.append_headers(headers) else: raise ResolverError('Video cannot be located.')
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 if html: sources = helpers.parse_sources_list(html) if sources: return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('File Not Found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content r = re.findall('InitializeStream.*?source:\s{0,1}[\'|\"](.*?)[\'|\"],', html, re.S) if r: return rot47(urllib.unquote(r[0])) + helpers.append_headers(headers) raise ResolverError('Video cannot be located.')
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 html = helpers.add_packed_data(html) sources = [] for match in re.finditer('label:\s*"([^"]+)"\s*,\s*file:\s*"([^"]+)', html): label, stream_url = match.groups() sources.append((label, stream_url)) sources = sorted(sources, key=lambda x: x[0])[::-1] print helpers.pick_source(sources) + helpers.append_headers(headers)
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.IE_USER_AGENT, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content iframe = re.findall('<iframe\s+src\s*=\s*"([^"]+)', html, re.DOTALL)[0] if iframe: html = self.net.http_GET(iframe, headers=headers).content html = helpers.add_packed_data(html) sources = helpers.scrape_sources(html, result_blacklist=['dl']) return helpers.pick_source(sources) + helpers.append_headers(headers)
def get_media_url(self, host, media_id): video = None web_url = self.get_url(host, media_id) if xbmc.getCondVisibility('System.HasAddon(plugin.video.gdrive)' ) and self.get_setting('use_gdrive'): doc_id = re.search('[-\w]{25,}', web_url) if doc_id: common.kodi.notify(header=None, msg='Resolving with GDRIVE', duration=3000) video = 'plugin://plugin.video.gdrive/?mode=video&instance=gdrive1&filename=%s&content_type=video' % doc_id.group( 1) if not video: response, video_urls = self._parse_google(web_url) if video_urls: video_urls.sort(key=self.__key, reverse=True) video = helpers.pick_source(video_urls) if response is not None: res_headers = response.get_headers(as_dict=True) if 'Set-Cookie' in res_headers: self.headers['Cookie'] = res_headers['Set-Cookie'] if not video: if any(url_match in web_url for url_match in self.url_matches): video = self._parse_redirect(web_url, hdrs=self.headers) elif 'googlevideo.' in web_url: video = web_url + helpers.append_headers(self.headers) elif 'plugin://' not in video: if any(url_match in video for url_match in self.url_matches): video = self._parse_redirect(video, hdrs=self.headers) if video: if 'plugin://' in video: # google plus embedded videos may result in this return video else: return video + helpers.append_headers(self.headers) raise ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) apiurl = 'https://api.tune.pk/v3/videos/{}'.format(media_id) currentTime = time.time() x_req_time = time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime(currentTime)) tunestring = 'videos/{} . {} . KH42JVbO'.format(media_id, int(currentTime)) token = hashlib.sha1(tunestring).hexdigest() headers = {'Content-Type': 'application/json; charset=utf-8', 'User-Agent': common.FF_USER_AGENT, 'X-KEY': '777750fea4d3bd585bf47dc1873619fc', #'X-REQ-APP': 'web' #not needed, returning bullshit hash anyways 'X-REQ-TIME': x_req_time, 'X-REQ-TOKEN': token} try: response = self.net.http_GET(apiurl, headers=headers) jdata = json.loads(response.content) if jdata['message'] == 'OK': vids = jdata['data']['videos']['files'] sources = [] for key in vids.keys(): sources.append((vids[key]['label'], vids[key]['file'])) sources.reverse() #because it is from worst to best? video_url = helpers.pick_source(sources) # hash recount serverTime = long(jdata['timestamp']) + (int(time.time()) - int(currentTime)) hashLifeDuration = long(jdata['data']['duration']) * 5 if hashLifeDuration < 3600: hashLifeDuration = 3600 expiryTime = serverTime + hashLifeDuration try: startOfPathUrl = video_url.index('/files/videos/') pathUrl = video_url[startOfPathUrl:None] except ValueError: try: startOfPathUrl = video_url.index('/files/streams/') pathUrl = video_url[startOfPathUrl:None] except ValueError: raise ResolverError('This video cannot be played.') htoken = hashlib.md5(str(expiryTime) + pathUrl + ' ' + 'c@ntr@lw3biutun3cb').digest() htoken = base64.urlsafe_b64encode(htoken).replace('=', '').replace('\n', '') video_url = video_url + '?h=' + htoken + '&ttl=' + str(expiryTime) headers = {'Referer': web_url, 'User-Agent': common.FF_USER_AGENT} return video_url + helpers.append_headers(headers) except: raise ResolverError('This video has been removed due to a copyright claim.')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.IE_USER_AGENT, 'Referer': web_url} html = self.net.http_GET(web_url, headers=headers).content url = re.findall('sources\s*:\s*\[(.+?)\]', html)[0] url = re.findall('(?:\"|\')(http.+?)(?:\"|\')', url) url = [i for i in url if '.mp4' in i] + [i for i in url if '.m3u8' in i] if url: return url[0] + helpers.append_headers(headers) else: raise ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: match = re.search('''['"]?sources['"]?\s*:\s*\[(.*?)\]''', html, re.DOTALL) if match: sources = [(source.rsplit('/', 1).pop(1), source) for source in re.findall('''['"](.*?)["']''', match.group(1), re.DOTALL)] return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError("Video not found")
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = { 'User-Agent': common.RAND_UA, 'Referer': 'https://video.sibnet.ru/' } html = self.net.http_GET(web_url, headers=headers).content source = re.search(r'src:\s*"([^"]+)', html) if source: return 'https://video.sibnet.ru' + source.group( 1) + helpers.append_headers(headers) raise ResolverError('Video not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: packed = helpers.get_packed_data(html) headers.update({'Referer': web_url}) sources = helpers.parse_sources_list(packed) if sources: return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError('File not found')
def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} response = self.net.http_GET(web_url, headers=headers) html = response.content if 'Not Found' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') sources = helpers.scrape_sources(html) return helpers.pick_source(sources) + helpers.append_headers(headers)