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://{0}/'.format(host) } try: r = self.net.http_GET(web_url, headers=headers).content except urllib_error.HTTPError: raise ResolverError('Video deleted or removed.') return src = re.findall(r'''ById\('.+?=\s*(["']//[^;<]+)''', r) if src: src_url = '' parts = src[-1].replace("'", '"').split('+') for part in parts: p1 = re.findall(r'"([^"]*)', part)[0] p2 = 0 if 'substring' in part: subs = re.findall(r'substring\((\d+)', part) for sub in subs: p2 += int(sub) src_url += p1[p2:] src_url += '&stream=1' src_url = 'https:' + src_url if src_url.startswith( '//') else src_url return helpers.get_redirect_url( src_url, headers) + 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) blurl = 'https://{0}/api/assets/userload/js/form.framework.js'.format( host) headers = {'User-Agent': common.RAND_UA} html = self.net.http_GET(web_url, headers=headers).content html = helpers.get_packed_data(html) headers.update({'Referer': web_url}) bl = self.net.http_GET(blurl, headers=headers).content if jsunhunt.detect(bl): bl = jsunhunt.unhunt(bl) b1 = re.search(r'url:\s*"([^"]+)', bl) b2 = re.search(r'data:\s*{([^}]+)', bl) if b1 and b2: bd = re.findall(r'"([^"]+)":\s*([^,\s]+)', b2.group(1)) data = {} for key, var in bd: r = re.search(r'{0}\s*=\s*"([^"]+)'.format(var), html) if r: data.update({key: r.group(1)}) if data: api_url = 'https://{0}{1}'.format(host, b1.group(1)) headers.update({ 'X-Requested-With': 'XMLHttpRequest', 'Origin': 'https://{0}'.format(host) }) stream_url = self.net.http_POST(api_url, data, headers=headers).content headers.pop('X-Requested-With') stream_url = helpers.get_redirect_url(stream_url, headers) 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.FF_USER_AGENT, 'Referer': 'https://{0}/'.format(host)} r = self.net.http_GET(web_url, headers=headers) src = re.search(r'"videolink"\).+?"([^"]+)', r.content) if src: src_url = 'https:' + src.group(1) if src.group(1).startswith('//') else src.group(1) src_url += '&stream=1' return helpers.get_redirect_url(src_url, headers) + 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, 'Referer': 'https://{0}/'.format(host) } r = self.net.http_GET(web_url, headers=headers) src = re.search(r'''ById\('vi.+?=\s*["']([^"']+)['"].+?["']([^"']+)''', r.content) if src: src_url = 'https:{0}{1}&stream=1'.format(src.group(1), src.group(2)) return helpers.get_redirect_url( src_url, headers) + 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.CHROME_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content html += helpers.get_packed_data(html) sources = helpers.scrape_sources(html) if sources: headers.update({'Referer': web_url}) vurl = helpers.pick_source(sources) vurl = re.sub('get[a-zA-Z]{4}-', 'getlink-', vurl) return helpers.get_redirect_url( vurl, headers) + 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.CHROME_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content if '<b>File not found, sorry!</b>' not in html: html += helpers.get_packed_data(html) v = re.search(r"player\s*=\s*.*?'([^']+)", html) if v: vurl = re.search( r'''{0}".+?src:\s*'([^']+)'''.format(v.group(1)), html) if vurl: return helpers.get_redirect_url( vurl.group(1), headers) + helpers.append_headers(headers) raise ResolverError('Video not found or removed')