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://vidembed.cc/' } key = '25746538592938496764662879833288'.encode('utf8') iv = self.f_random(16) encryptor = pyaes.Encrypter( pyaes.AESModeOfOperationCBC(key, iv.encode('utf8'))) eid = encryptor.feed(media_id) eid += encryptor.feed() url = 'https://vidembed.cc' + '/encrypt-ajax.php?id=' + base64.b64encode(eid).decode('utf8') \ + '&refer=none&time=' + self.f_random(2) + iv + self.f_random(2) headers.update({"X-Requested-With": "XMLHttpRequest"}) js_data = json.loads(self.net.http_GET(url, headers=headers).content) sources = js_data.get('source', None) if sources: sources = [(source.get('label'), source.get('file')) for source in sources] headers.pop('X-Requested-With') source = helpers.pick_source(helpers.sort_sources_list(sources)) return source + helpers.append_headers(headers) # Try Beta Server if no sources found with earlier method headers.pop("X-Requested-With") html = self.net.http_GET(web_url, headers=headers).content sources = helpers.scrape_sources(html) if sources: headers.update({'Origin': 'https://vidembed.cc'}) return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('Video not found')
def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url, headers=self.headers).content stream_map = urllib_parse.unquote( re.findall('url_encoded_fmt_stream_map=([^&]+)', html)[0]) streams = stream_map.split(',') sources = [] streams_mp4 = [item for item in streams if 'video%2Fmp4' in item] for stream in streams_mp4: quality = re.findall('quality=([^&]+)', stream)[0] url = re.findall('url=([^&]+)', stream)[0] sources.append((quality, urllib_parse.unquote(url))) if sources: return helpers.pick_source(sources) except: if youtube_resolver is None: return 'plugin://plugin.video.youtube/play/?video_id=' + media_id else: streams = youtube_resolver.resolve(media_id) streams_no_dash = [ item for item in streams if item['container'] != 'mpd' ] stream_tuples = [(item['title'], item['url']) for item in streams_no_dash] if stream_tuples: return helpers.pick_source(stream_tuples) 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} r = self.net.http_GET(web_url, headers=headers) if r.get_url() != web_url: host = re.findall(r'(?://|\.)([^/]+)', r.get_url())[0] web_url = self.get_url(host, media_id) headers.update({'Referer': web_url}) api_url = 'https://{0}/api/source/{1}'.format(host, media_id) r = self.net.http_POST(api_url, form_data={'r': '', 'd': host}, headers=headers) if r.get_url() != api_url: api_url = 'https://www.{0}/api/source/{1}'.format(host, media_id) r = self.net.http_POST(api_url, form_data={'r': '', 'd': host}, headers=headers) js_result = r.content if js_result: js_data = json.loads(js_result) if js_data.get('success'): sources = [(i.get('label'), i.get('file')) for i in js_data.get('data') if i.get('type') == 'mp4'] common.logger.log(sources) sources = helpers.sort_sources_list(sources) rurl = helpers.pick_source(sources) str_url = self.net.http_HEAD(rurl, headers=headers).get_url() return str_url + 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) 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']] sorted(sources) source = helpers.pick_source(sources) source = source.encode('utf-8') if helpers.PY2 else source if source.startswith("//"): source = 'http:%s' % source 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): headers = {'User-Agent': common.RAND_UA} web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url, headers=headers).content if html: try: if media_id.startswith('embed/'): web_url = re.search('''link:\s*["']([^"']+)''', html).groups()[0] html = self.net.http_GET(web_url, headers=headers).content sources = re.findall( '''['"]?file['"]?:\s*['"]([^'"]+).+?['"]?type['"]?:\s*['"]([^'"]+)''', html) if sources: sources = [(i[1], i[0]) for i in sources] return self.net.http_GET( helpers.pick_source(sources), headers=headers).get_url( ) + 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) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: vars = re.findall('var\s+(.+?)\s*=\s*(.+?);', html) links = re.findall('quality_(\d+)p\s*=\s*(.+?);', html) if links: sources = [] for source in links: try: link = [i.strip() for i in source[1].split('+')] link = [i for i in link if i.startswith('*/')] link = [re.sub('^\*/', '', i) for i in link] link = [(i, [x[1] for x in vars if x[0] == i]) for i in link] link = [i[1][0] if i[1] else i[0] for i in link] link = ''.join(link) link = re.sub('\s|\+|\'|\"', '', link) sources.append([source[0], link]) except: continue return helpers.pick_source(sources) 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 'Not Found' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search(r"JuicyCodes\.Run\((.+?)\)", html, re.I) if packed: from base64 import b64decode packed = packed.group(1).replace('"', '').replace('+', '') packed = b64decode(packed.encode('ascii')) html += '%s</script>' % packed.decode('latin-1').strip() 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, 'Origin': 'https://{0}'.format(host), 'X-Requested-With': 'XMLHttpRequest' } data = {'id': media_id} api_url = 'https://{0}/api/video/get'.format(host) html = self.net.http_POST(api_url, data, headers=headers, jdata=True).content r = json.loads(html).get('result').get('playlist') if r: if '{' in r: data = json.loads(r) ct = data.get('ct', False) salt = codecs.decode(data.get('s'), 'hex') murl = json.loads(jscrypto.decode(ct, '2021', salt)) else: murl = r headers.pop('X-Requested-With') html = self.net.http_GET(murl, headers=headers).content sources = re.findall( r'RESOLUTION=\d+x(?P<label>[\d]+).*\n(?!#)(?P<url>[^\n]+)', html, re.IGNORECASE) if sources: stream_url = urllib_parse.urljoin( murl, helpers.pick_source(helpers.sort_sources_list(sources))) return stream_url + 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} html = self.net.http_GET(web_url, headers=headers).content if html: try: pattern = r"""{\s*vid:\s*'([^']+)',\s*hash\s*:\s*["\']([\da-f]{32})""" id, hash = re.findall(pattern, html)[0] hash_code = ''.join((self.encode_base_n(int(hash[lb:lb + 8], 16), 36) for lb in range(0, 32, 8))) load_url = 'https://www.eporner.com/xhr/video/%s?hash=%s&device=generic&domain=www.eporner.com&fallback=false&embed=false&supportedFormats=mp4' % (id, hash_code) headers.update({'Referer': web_url}) r = self.net.http_GET(load_url, headers=headers).content r = r.replace("\/", "/") r = json.loads(r).get("sources", {}).get('mp4', {}) sources = [(i, r[i].get("src")) for i in r] 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])|') return helpers.pick_source(sources) + helpers.append_headers(headers) except: raise ResolverError('File not found') raise ResolverError('File not found')
def get_media_url(self, host, media_id): if '$$' in media_id: media_id, referer = media_id.split('$$') referer = urllib_parse.urljoin(referer, '/') else: referer = False web_url = self.get_url(host, media_id) if not referer: referer = urllib_parse.urljoin(web_url, '/') headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer} html = self.net.http_GET(web_url, headers=headers).content if 'Please Wait' in html: raise ResolverError('Please Wait Video Uploading.') html = helpers.get_packed_data(html) sources = re.findall( r"label':\s*'(?P<label>[^']+).+?file':\s*'(?P<url>[^']+)", html) if sources: source = helpers.pick_source(sorted(sources, reverse=True)) if source.startswith('/'): source = urllib_parse.urljoin(web_url, source) return source + helpers.append_headers(headers) 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.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).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(r"JuicyCodes\.Run\((.+?)\)", html, re.I) if packed: from base64 import b64decode packed = packed.group(1).replace('"', '').replace('+', '') packed = b64decode(packed.encode('ascii')) html += '%s</script>' % packed.decode('latin-1').strip() source = helpers.scrape_sources(html) if source: headers.update({'Referer': web_url, 'Accept': '*/*'}) vsrv = re.findall(r'//(\d+)/', source[0][1])[0] source = re.sub(r"//\d+/", "//{0}/".format(host), source[0][1]) + '?s={0}&d='.format(vsrv) html = self.net.http_GET(source, headers=headers).content sources = re.findall(r'RESOLUTION=\d+x(\d+)\n([^\n]+)', html) return helpers.pick_source(helpers.sort_sources_list( 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) response = self.net.http_GET(web_url) html = response.content try: if 'config.playwire.com' in host: response = json.loads(html)['content']['media']['f4m'] elif 'v2' not in host: response = re.findall(r'<src>(.+?)</src>', html)[0] else: response = json.loads(html)['src'] return response response = self.net.http_GET(response).content baseURL = re.findall(r'<baseURL>\s*(.+)\s*</baseURL>', response)[0] media = re.findall(r'<media\s*url="(\S+mp4)".+?height="(\d+)"', response) media.sort(key=lambda x: x[1], reverse=True) sources = [(i[1], '{0}/{1}'.format(baseURL, i[0])) for i in media] source = helpers.pick_source(sources) source = source.encode('utf-8') if helpers.PY2 else source return source except: raise ResolverError('Unable to resolve url.') 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.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: try: pattern = r"""ajax\(url,opts\);}}\)\(([\d]+),[\d]+,\[([\d,]+)\]\);""" url_id, quals = re.findall(pattern, html)[0] quals = quals.replace(',', '+') headers.update({'Referer': web_url, 'Origin': host}) post_url = 'https://tkn.kodicdn.com/0000000%s/desktop/%s' % ( url_id, quals) html = self.net.http_POST(post_url, headers=headers, form_data='').content if html: sources = helpers.scrape_sources( html, patterns=[ """['"](?P<label>\d+)['"]:{[\w":,]+token['"]:['"](?P<url>[^'"]+)""" ]) if sources: return helpers.pick_source( sources) + helpers.append_headers(headers) except: raise ResolverError('File not found') raise ResolverError('File not found')
def get_media_url(self, host, media_id): surl = 'https://abcvideo.cc/dl' domain = 'aHR0cHM6Ly9hYmN2aWRlby5jYzo0NDM.' web_url = self.get_url(host, media_id) rurl = 'https://{0}/'.format(host) headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': rurl} html = self.net.http_GET(web_url, headers).content token = helpers.girc(html, rurl, domain) if token: data = { 'op': 'video_src', 'file_code': media_id, 'g-recaptcha-response': token } headers.update({'X-Requested-With': 'XMLHttpRequest'}) shtml = self.net.http_GET('{0}?{1}'.format( surl, urllib_parse.urlencode(data)), headers=headers).content sources = helpers.scrape_sources(shtml) if sources: headers.pop('X-Requested-With') return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('File Not Found or removed')
def get_media_url(self, host, media_id): if '|' in media_id: media_id, referer = media_id.split('|') else: referer = False web_url = self.get_url(host, media_id) if not referer: referer = web_url headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer} response = self.net.http_GET(web_url, headers=headers) html = response.content params = re.search(r'video:\s*([^;]+)', html) if params: params = params.group(1) id = re.findall(r'cdn_id:\s*"([^"]+)', params)[0] id1, id2 = id.split('_') server = re.findall(r'server:\s*"([^"]+)', params)[0][::-1] server = base64.b64decode(server.encode('ascii')).decode('ascii') sources = json.loads(re.findall(r'cdn_files:\s*([^}]+})', params)[0]) sources = [(key[4:], 'https://{0}/videos/{1}/{2}/{3}'.format(server, id1, id2, sources[key].replace('.', '.mp4?extra='))) for key in list(sources.keys())] return helpers.pick_source(sorted(sources, reverse=True)) + helpers.append_headers(headers) 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.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content if html: try: params = "".join([ x.replace("' + '", "") for x in self.between(html, "params += '", "';") ]) vkey = params.split('=')[-1] m = hashlib.md5() m.update(vkey + 'PT6l13umqV8K827') params += '&pkey=%s' % m.hexdigest() params = urllib.unquote(params) url = 'http://www.drtuber.com/player_config/?' + params sources_html = self.net.http_GET(url, headers=headers).content if sources_html: sources = helpers.scrape_sources( sources_html, patterns=[ """video_file>\<\!\[CDATA\[(?P<url>[^\]]+)""" ]) if sources: return helpers.pick_source( sources) + helpers.append_headers(headers) except: raise ResolverError('File not found') raise ResolverError('File not found')
def get_media_url(self, host, media_id): url = self.get_url(host, media_id) if 'vidembed' in url or 'vb.icdrama' in url: headers = self.headers headers['Referer'] = 'http://icdrama.to' response = requests.get(url, headers=headers) streams = self._extract_streams(response) cmn.debug("Icdrama: Extracted links... " + str(streams)) unwrapped_url = '' unwrapped_url = helpers.pick_source(streams, auto_pick=False) if ('redirector.googlevideo.com' in unwrapped_url or 'blogspot.com' in unwrapped_url or 'fbcdn.net' in unwrapped_url): #for current Videobug source # Kodi can play directly, skip further resolve return unwrapped_url return urlresolver.resolve(unwrapped_url) else: try: html = self.net.http_GET(url, headers=self.headers).content iframe = BeautifulSoup(html, 'html5lib').find('iframe') return urlresolver.resolve(iframe['src']) except: return None
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) 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 = {'User-Agent': common.CHROME_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content headers.update({'Referer': web_url}) if 'sorry' in html: raise ResolverError("Video Deleted") r = re.search(r"redirect_vid\('([^']+)','([^']+)','([^']+)'", html) if r: surl = 'https://{0}/dl?op=download_orig&id={1}&mode={2}&hash={3}'.format( host, r.group(1), r.group(2), r.group(3) ) dhtml = self.net.http_GET(surl, headers=headers).content s = re.search('href="([^"]+)">Direct', dhtml) if s: return s.group(1) + helpers.append_headers(headers) html += helpers.get_packed_data(html) sources = helpers.scrape_sources(html, patterns=[r'''sources:\s*\[(?:{file:)?\s*"(?P<url>[^"]+)'''], generic_patterns=False) 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} html = self.net.http_GET(web_url, headers=headers).content if html: sources = [] pattern = '''src:\s*canPlayDash\s*\?\s*['"]\s*(?P<dash>[^'"]+)\s*['"]\s*:\s*['"]\s*(?P<hls>[^'"]+)\s*['"]''' match = re.search(pattern=pattern, string=html) if not match: pattern = '''data-hls-url\s*=\s*['"]\s*(?P<hls>[^'"]+).+?data-mpd-url\s*=\s*['"]\s*(?P<dash>[^'"]+)''' match = re.search(pattern=pattern, string=html) if match: if self.dash_supported: sources += [('Reddit', match.group('dash'))] else: sources += [('Reddit', match.group('hls'))] 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} html = self.net.http_GET(web_url, headers=headers).content if html: video_id = re.search("""playvideo\.php\?id=(\d+)""", html) if video_id: video_url = 'http://%s/jwplayer/playvideo.php?id=%s' % ( host, video_id.group(1)) headers.update({'Referer': web_url}) _html = self.net.http_GET(video_url, headers=headers).content if _html: try: _html = jsunpack.unpack(_html) except Exception as e: raise ResolverError(e) sources = helpers.scrape_sources( _html, patterns=['''file:\s*["'](?P<url>http[^"']+)''']) 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} html = self.net.http_GET(web_url, headers=headers).content headers.update({'Referer': web_url}) match = re.search(r'Video is processing now\.', html) if match: raise ResolverError('Video is still processing. Try later') match = re.search(r'&hash=([^&]+)', html) if match: web_url = 'https://wolfstream.tv/dl?op=download_orig&id={0}&mode=o&hash={1}'.format( media_id, match.group(1)) html2 = self.net.http_GET(web_url, headers=headers).content r = re.search(r'<a\s*href="([^"]+)[^>]+>Direct', html2) if r: return r.group(1) + helpers.append_headers(headers) match = re.search(r'(?:src|file):\s*"([^"]+)', html) if match: html2 = self.net.http_GET(match.group(1), headers=headers).content sources = re.findall( r'RESOLUTION=\d+x(?P<label>[\d]+).+\n(?!#)(?P<url>[^\n]+)', html2, re.IGNORECASE) if sources: return helpers.pick_source(helpers.sort_sources_list( sources)) + 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} html = self.net.http_GET(web_url, headers=headers).content if html: if 'sucuri_cloudproxy_js' in html: cookie = self.sucuri(html) headers.update({'Referer': web_url, 'Cookie': cookie}) html = self.net.http_GET(web_url, headers=headers).content sources = re.findall( '''<source\s*.+?label=['"](\w+)['"]\s*src=['"]([^'"]+)''', html) sources = [(i[0], i[1]) for i in sources if not i[1] == "dead_link"] if sources: try: sources.sort(key=lambda x: int(re.sub("\D", "", x[0])), reverse=True) except: pass return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('File not found')
def get_media_url(self, host, media_id): headers = {'User-Agent': common.RAND_UA} web_url = self.get_url(host, media_id) if not media_id.isdigit(): html = self.net.http_GET(web_url, headers=headers).content if html: try: web_url = re.search( """<iframe\s*width=['"]\d+['"]\s*height=['"]\d+['"]\s*src=['"](http:\/\/www\.hclips\.com\/embed\/(\d+))""", html).groups()[0] except: raise ResolverError('File not found') else: raise ResolverError('File not found') html2 = self.net.http_GET(web_url, headers=headers).content if html2: sources = re.findall( ''''label['"]:.+?,['"]file['"]:\s*['"](?P<url>[^'"]+)['"],['"]type['"]:\s*['"](?P<label>[^'"]+)''', html2, re.DOTALL) if sources: sources = [(i[1], i[0]) for i in sources] return self.net.http_GET(helpers.pick_source(sources), headers=headers).get_url( ) + helpers.append_headers(headers) raise ResolverError('File not found')
def get_media_url(self, host, media_id): if '$$' in media_id: media_id, referer = media_id.split('$$') referer = urllib_parse.urljoin(referer, '/') else: referer = False web_url = self.get_url(host, media_id) if not referer: referer = urllib_parse.urljoin(web_url, '/') headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer} html = self.net.http_GET(web_url, headers=headers).content params = re.search(r'video:\s*([^;]+)', html) if params: params = params.group(1) server = re.findall(r'server:\s*"([^"]+)', params)[0][::-1] server = base64.b64decode(server.encode('ascii')).decode('ascii') ids = re.search(r'cdn_id:\s*"([^"]+)', params) if ids: id1, id2 = ids.group(1).split('_') sources = json.loads( re.findall(r'cdn_files:\s*([^}]+})', params)[0]) sources = [(key[4:], 'https://{0}/videos/{1}/{2}/{3}'.format( server, id1, id2, sources[key].replace('.', '.mp4?extra='))) for key in list(sources.keys())] else: vid = re.findall(r'id:\s*"([^"]+)', params)[0] ekeys = json.loads( re.findall(r'quality":\s*([^}]+})', params)[0]) data = { 'token': re.findall(r'access_token:\s*"([^"]+)', params)[0], 'videos': vid, 'ckey': re.findall(r'c_key:\s*"([^"]+)', params)[0], 'credentials': re.findall(r'credentials:\s*"([^"]+)', params)[0] } vurl = 'https://{0}/method/video.get/{1}?{2}'.format( server, vid, urllib_parse.urlencode(data)) headers.update({'Origin': referer[:-1]}) vhtml = self.net.http_GET(vurl, headers=headers).content sources = json.loads(vhtml).get('response').get( 'items')[0].get('files') sources = [(key[4:], sources[key] + '&videos={0}&extra_key={1}&videos={0}'.format( vid, ekeys[key[4:]])) for key in list(sources.keys())] source = helpers.pick_source(sorted(sources, reverse=True)) if 'extra_key' in source: source = source.replace('https://', 'https://{0}/'.format(server)) return source + helpers.append_headers(headers) 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.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content sources = helpers.scrape_sources(html) if sources: return helpers.pick_source(helpers.sort_sources_list( 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} html = self.net.http_GET(web_url, headers=headers).content sources = helpers.scrape_sources(html) if sources: headers.update({'verifypeer': 'false'}) return helpers.pick_source(sources) + helpers.append_headers( headers) raise ResolverError('Video cannot be located.')
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(list( result.items())) + helpers.append_headers(self.headers) raise ResolverError(i18n('no_ip_authorization'))
def get_media_url(self, host, media_id): video = None web_url = self.get_url(host, media_id) if xbmc.getCondVisibility( 'System.HasAddon(plugin.googledrive)') and self.get_setting( 'use_gdrive') == "true": addon = xbmcaddon.Addon('plugin.googledrive') if six.PY3: db = xbmcvfs.translatePath( addon.getAddonInfo('profile')) + 'accounts.db' else: db = xbmc.translatePath( addon.getAddonInfo('profile')) + 'accounts.db' conn = sqlite3.connect(db) c = conn.cursor() c.execute("SELECT key FROM store;") driveid = c.fetchone()[0] conn.close() doc_id = re.search(r'[-\w]{25,}', web_url) if doc_id: common.kodi.notify(header=None, msg='Resolving with Google Drive', duration=3000) video = 'plugin://plugin.googledrive/?action=play&content_type=video&driveid={0}&item_id={1}'.format( driveid, doc_id.group(0)) 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 __check_smil_dash(source, headers): is_dash = False if '.smil' in source: smil_result = __get_html_and_headers(source, headers) source = pick_source(parse_smil_source_list(smil_result['contents'])) elif '.mpd' in source and not dash_supported: is_dash = False source = None elif '.mpd' in source and dash_supported: is_dash = True return {'url': source, 'is_dash': is_dash}
def get_media_url(self, host, media_id): url = self.get_url(host, media_id) headers = self.headers headers['Referer'] = 'http://icdrama.se' response = requests.get(url, headers=headers) streams = self._extract_streams(response) url = helpers.pick_source(streams, auto_pick=False) if ('redirector.googlevideo.com' in url or 'blogspot.com' in url): # Kodi can play directly, skip further resolve return url return urlresolver.resolve(url)