Fix for some Live Channels

This commit is contained in:
UrloMythus
2024-10-06 20:57:43 +02:00 Unverified
parent 459ca29322
commit 2ce727a9ae
2 changed files with 54 additions and 55 deletions
+6 -7
View File
@@ -7,6 +7,7 @@ env_vars = load_env()
MEDIAFLOW_PASS = env_vars.get('MEDIAFLOW_PASS')
Referer = "https://ilovetoplay.xyz/"
Origin = "https://ilovetoplay.xyz"
key_url = "https%3A%2F%2Fkey2.videohls.ru%2F"
headers = {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0",
"Accept": "*/*",
@@ -23,17 +24,15 @@ headers = {
"Pragma": "no-cache",
"Cache-Control": "no-cache",
}
medialink = config.MediaProxy
async def get_stream_link(id,site,client):
try:
if site == "dlhd":
m3u8_url = webru_dlhd[id]
stream_url = "https://xyzdddd.videohls.ru/lb/" + webru_dlhd[id] + "/index.m3u8"
elif site == "vary":
m3u8_url = webru_vary[id]
response = await client.get(m3u8_url, headers=headers, allow_redirects=False, impersonate = "chrome120")
if response.status_code == 301:
stream_url = response.headers.get("Location", "")
return stream_url,Referer,Origin
stream_url = "https://webuit.videohls.ru/lb/"+ webru_vary[id] + "/index.m3u8"
return stream_url,Referer,Origin
except Exception as e:
return None
async def webru(id,site,client):
@@ -41,7 +40,7 @@ async def webru(id,site,client):
stream_url, Referer,Origin = await get_stream_link(id,site,client)
mediaproxy = config.MediaProxy
medialink = random.choice(mediaproxy)
new_stream_url = f'{medialink}proxy/hls?key_url=https%3A%2F%2Fkey.mizhls.ru%2F&api_password={MEDIAFLOW_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'
new_stream_url = f'{medialink}proxy/hls?key_url={key_url}&api_password={MEDIAFLOW_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
except Exception as e:
print("WebRu failed",e)