def get_link(url, media): response = Request().get(url) sources = re.search(r'sources:\s?(.*?),\n', response) sources = helper.convert_js_2_json(sources.group(1).encode('utf-8')) if sources: try: sources = sorted(sources, key=lambda elem: int(elem['label'][0:-1]), reverse=True) except: pass url = "" if len(sources) > 0: for source in sources: url = source.get('file') break # if re.search('pegasus-pop.com', url): # header = { # 'Origin': 'https://live.90m.tv', # 'User-Agent': "Chrome/59.0.3071.115 Safari/537.36", # 'referer': media.get('originUrl') # } # return url + "|%s" % urlencode(header) url, mtype = cors.get_link(url, media) return url
def get_link(url, media): print "Apply vanlongstreaming parser" base_url = urlparse(url) id = parse_qs(base_url.query).get('id')[0] base_url = base_url.scheme + '://' + base_url.netloc url = '%s/hls/%s/%s.playlist.m3u8' % (base_url, id, id) return cors.get_link(url, media, False)
def get_link(url, media): header = { 'Referer': media.get('originUrl'), # 'User-Agent': "Chrome/59.0.3071.115 Safari/537.36", # 'Origin': media.get('originUrl') } response = Request().get(url, headers=header) source = re.search(r'var\sVIDEO_URL="(.*?)";', response) or re.search(r'var\sVIDEO_URL=swapServer\("(.*)"\);', response) if source: return cors.get_link(source.group(1), media) sources = re.search(r'var\slistFile=(\[.*?\]);', response) if sources: sources = json.loads(sources.group(1)) return cors.get_link(sources[0].get('file'), media) return None, None
def get_link(url, media, include_header=True): base_url = urlparse(media.get('originUrl')) base_url = base_url.scheme + '://' + base_url.netloc host_url = urlparse(url) r = Request() r.head(url) if include_header: return cors.get_link(r.get_request().history[0].headers['Location'], media) return r.get_request().history[0].headers['Location'], host_url.netloc
def get_link(url, media): header = { 'Referer': media.get('originUrl'), # 'User-Agent': "Chrome/59.0.3071.115 Safari/537.36", # 'Origin': media.get('originUrl') } id = re.search(r'\/embed\/([a-f0-9]{32})', url).group(1) murl = "https://gpt2.phimmoi.net/getLinkStreamMd5/{}".format(id) response = Request().get(murl, headers=header) items = json.loads(response) items = sorted(items, key=lambda elem: int(elem.get('label')[0:-1]), reverse=True) return cors.get_link(items[0].get('file'), media)
def get_link(url, media): print "Apply vanlongstreaming parser" base_url = urlparse(url) id = parse_qs(base_url.query).get('id')[0] base_url = base_url.scheme + '://' + base_url.netloc url = '%s/hls/%s/%s.playlist.m3u8' % (base_url, id, id) header = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 8.1.0; SAMSUNG SM-N960F Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.0 Chrome/63.0.3239.111 Mobile Safari/537.36', 'Origin': base_url, 'verifypeer': 'false' } return url + "|%s" % urlencode(header), 'vanlong' return cors.get_link(url, media, True)
def get_link(url, movie): base_url = urlparse(url) base_url = base_url.scheme + '://' + base_url.netloc request = Request() if 'embedplay' in url: return iframeembed.get_link(url, movie) if url.endswith('m3u8'): header = { 'Origin': 'http://www.vtv16.com', 'User-Agent': "Chrome/59.0.3071.115 Safari/537.36", 'Referer': movie.get('originUrl') } return url + "|%s" % urlencode(header), base_url # method 1 try: mid = re.search(r'\?id=((?:(?!\?).)*)', url).group(1) base_url = urlparse(url) base_url = base_url.scheme + '://' + base_url.netloc url = "%s/hls/%s/%s.playlist.m3u8" % (base_url, mid, mid) return cors.get_link(url, movie, including_agent=False) except: pass # method 2 request.get(url) location = request.get_request().history[0].headers['Location'] base_url = urlparse(location) base_url = base_url.scheme + '://' + base_url.netloc # https://vip4.movie3s.net/public/dist/index.html?id=0676953662683db3977a8d30e4084414 mid = re.search(r'\?id=(.*)', location).group(1) return '%s/hls/%s/%s.playlist.m3u8' % (base_url, mid, mid), base_url # method 3 medias = json.loads(request.post('%s/vl/%s' % (base_url, mid))) if '720p' in medias: return create_stream(medias['720p'], base_url) return url, base_url