diff --git a/Src/API/webru.py b/Src/API/webru.py index 473991d..cc06f48 100644 --- a/Src/API/webru.py +++ b/Src/API/webru.py @@ -62,7 +62,13 @@ async def get_stream_link(id,site,client): href = soup.find('a').get('href') response = await client.get(href) soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('button')) - webru_iframe = soup.find('button', {"data-type": "embed"}).get('data-url') + webru_iframe = soup.find_all('button', {"data-type": "embed"}) + for i in webru_iframe: + webru_iframe = i.get('data-url') + if "php" not in webru_iframe: + continue + else: + break webru_iframe = "https://" + webru_iframe.split("/")[2] vary_id = webru_vary[id] vary_link = f"{webru_iframe}/server_lookup.php?channel_id={vary_id}" diff --git a/run.py b/run.py index 41e0da0..d4c6dff 100644 --- a/run.py +++ b/run.py @@ -266,11 +266,14 @@ async def addon_stream(request: Request,config, type, id,): if id in webru_vary: i = i+1 webru_url, Referer_webru_url,Origin_webru_url = await webru(id,"vary",client) - if MFP== "1": + if MFP== "1" and webru_url: webru_url = f'{MFP_url}/proxy/hls/manifest.m3u8?api_password={MFP_password}&d={webru_url}&h_Referer={Referer_webru_url}&h_Origin={Origin_webru_url}&h_User-Agent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F58.0.3029.110%20Safari%2F537.3' + print(webru_url) + streams['streams'].append({'title': f"{Icon}Proxied Server X-{i} " + channel['title'],'url': webru_url}) else: - streams['streams'].append({'title': f'{Icon}Server X-{i}' + channel['title'], 'url': webru_url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": Origin_webru_url, "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": Referer_webru_url, "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers"}}}}) + if webru_url: + streams['streams'].append({'title': f'{Icon}Server X-{i}' + channel['title'], 'url': webru_url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": Origin_webru_url, "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": Referer_webru_url, "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers"}}}}) if id in webru_dlhd: if DLHD == "1":