Added Support for DLHD channels without MFP

This commit is contained in:
UrloMythus
2025-02-16 21:25:20 +01:00 Unverified
parent 8dedb34b95
commit 11ac08e5eb
2 changed files with 14 additions and 11 deletions
+5 -8
View File
@@ -29,7 +29,7 @@ headers = {
"Cache-Control": "no-cache",
}
async def get_stream_link(id,site,MFP_CREDENTIALS,client):
async def get_stream_link(id,site,client):
try:
if site == "dlhd":
dlhd_id = webru_dlhd[id]
@@ -71,16 +71,13 @@ async def get_stream_link(id,site,MFP_CREDENTIALS,client):
else:
print("No .m3u8 URL found.")
stream_url = f"https://{domain}/lb/"+ webru_vary[id] + "/index.m3u8"
mfp_url = MFP_CREDENTIALS[0]
mfp_pass = MFP_CREDENTIALS[1]
new_stream_url = f'{mfp_url}/proxy/hls/manifest.m3u8?api_password={mfp_pass}&d={stream_url}&h_Referer={Referer}&h_Origin={Origin}&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'
return new_stream_url
return stream_url,Referer,Origin
except Exception as e:
return None
async def webru(id,site,client,MFP_CREDENTIALS):
async def webru(id,site,client):
try:
new_stream_url = await get_stream_link(id,site,MFP_CREDENTIALS,client)
return new_stream_url
new_stream_url,Referer,Origin = await get_stream_link(id,site,client)
return new_stream_url,Referer,Origin
except Exception as e:
print("WebRu failed",e)
return None
+8 -2
View File
@@ -254,13 +254,19 @@ async def addon_stream(request: Request,config, type, id,):
if MFP == "1":
if id in webru_vary:
i = i+1
webru_url = await webru(id,"vary",client, MFP_CREDENTIALS)
webru_url = await webru(id,"vary",client)
streams['streams'].append({'title': f"{Icon}Server X-{i} " + channel['title'],'url': webru_url})
if id in webru_dlhd:
if DLHD == "1":
i = i+1
webru_url_2 = await webru(id,"dlhd",client,MFP_CREDENTIALS)
webru_url_2,Referer_webru_url_2,Origin_webru_url_2 = await webru(id,"dlhd",client)
if MFP== "1":
webru_url_2 = f'{MFP_url}/proxy/hls/manifest.m3u8?api_password={MFP_password}&d={webru_url_2}&h_Referer={Referer_webru_url_2}&h_Origin={Origin_webru_url_2}&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'
streams['streams'].append({'title': f"{Icon}Server D-{i} " + channel['title'],'url': webru_url_2})
else:
streams['streams'].append({'title': f'{Icon}Server D-{i}' + channel['title'], 'url': webru_url_2, "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_2, "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": Referer_webru_url_2, "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers"}}}})
if not streams['streams']:
raise HTTPException(status_code=404)