Fixed X channels and Live TV
This commit is contained in:
+28
-19
@@ -55,23 +55,21 @@ async def get_stream_link(id,site,client):
|
|||||||
print("No .m3u8 URL found.")
|
print("No .m3u8 URL found.")
|
||||||
'''
|
'''
|
||||||
stream_url = f"https://{server_key}new.iosplayer.ru/{server_key}/{dlhd_id}" + "/mono.m3u8"
|
stream_url = f"https://{server_key}new.iosplayer.ru/{server_key}/{dlhd_id}" + "/mono.m3u8"
|
||||||
|
return stream_url,Referer,Origin
|
||||||
elif site == "vary":
|
elif site == "vary":
|
||||||
response = await client.get(f"https://www.tanti.{TF_DOMAIN}/tv-channel/sky-cinema-action-2", impersonate = "chrome124", headers = headers, timeout = 10)
|
response = await client.get("https://calcio.monster/streaming-gratis-calcio-1.php")
|
||||||
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('iframe'))
|
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('div', class_='ticket_btn'))
|
||||||
iframe = soup.find('iframe', class_='embed-responsive-item')
|
href = soup.find('a').get('href')
|
||||||
real_link = iframe.get('src')
|
response = await client.get(href)
|
||||||
response = await client.get(real_link, allow_redirects = False)
|
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('button'))
|
||||||
pattern = r"source:\s*'([^']*\.m3u8)'"
|
webru_iframe = soup.find('button', {"data-type": "embed"}).get('data-url')
|
||||||
match = re.search(pattern, response.text)
|
webru_iframe = "https://" + webru_iframe.split("/")[2]
|
||||||
if match:
|
vary_id = webru_vary[id]
|
||||||
m3u8_url = match.group(1) # The URL is captured in the first capturing group
|
vary_link = f"{webru_iframe}/server_lookup.php?channel_id={vary_id}"
|
||||||
parsed_url = urlparse(m3u8_url)
|
response = await client.get(vary_link, headers=headers, allow_redirects=True, impersonate = "chrome124")
|
||||||
domain = parsed_url.netloc
|
server_key = response.json()['server_key']
|
||||||
|
stream_url = f"https://{server_key}new.iosplayer.ru/{server_key}/{vary_id}" + "/mono.m3u8"
|
||||||
else:
|
return stream_url,Referer,Origin
|
||||||
print("No .m3u8 URL found.")
|
|
||||||
stream_url = f"https://{domain}/lb/"+ webru_vary[id] + "/index.m3u8"
|
|
||||||
return stream_url,Referer,Origin
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return None
|
return None
|
||||||
async def webru(id,site,client):
|
async def webru(id,site,client):
|
||||||
@@ -80,7 +78,7 @@ async def webru(id,site,client):
|
|||||||
return new_stream_url,Referer,Origin
|
return new_stream_url,Referer,Origin
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("WebRu failed",e)
|
print("WebRu failed",e)
|
||||||
return None
|
return None,None,None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +95,7 @@ async def get_skystreaming(id,client):
|
|||||||
return m3u8_url,Host,Origin
|
return m3u8_url,Host,Origin
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("SkyStreaming failed",e)
|
print("SkyStreaming failed",e)
|
||||||
return None,None
|
return None,None,None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -164,4 +162,15 @@ async def webru2(id,site,client):
|
|||||||
url,Host = await get_skystreaming(id,client)
|
url,Host = await get_skystreaming(id,client)
|
||||||
streams['streams'].append({'title': f'{HF}Server {i}', 'url': url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": "https://skystreaming.guru", "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": "https://skystreaming.guru/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers","Host": Host}}}})
|
streams['streams'].append({'title': f'{HF}Server {i}', 'url': url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": "https://skystreaming.guru", "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": "https://skystreaming.guru/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers","Host": Host}}}})
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
async def test_webru():
|
||||||
|
from curl_cffi.requests import AsyncSession
|
||||||
|
async with AsyncSession() as client:
|
||||||
|
# Replace with actual id, for example 'anime_id:episode' format
|
||||||
|
test_id = "sky-sport-uno" # This is an example ID format
|
||||||
|
results = await get_skystreaming(test_id,client)
|
||||||
|
print(results)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import asyncio
|
||||||
|
asyncio.run(test_webru())
|
||||||
@@ -251,20 +251,24 @@ async def addon_stream(request: Request,config, type, id,):
|
|||||||
i = i+1
|
i = i+1
|
||||||
if url:
|
if url:
|
||||||
streams['streams'].append({'title': f'{Icon}Server S {i}' + channel['title'], 'url': url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": Sky_Origin, "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": f"{Sky_Origin}/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers","Host": Host}}}})
|
streams['streams'].append({'title': f'{Icon}Server S {i}' + channel['title'], 'url': url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": Sky_Origin, "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": f"{Sky_Origin}/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers","Host": Host}}}})
|
||||||
if MFP == "1":
|
if id in webru_vary:
|
||||||
if id in webru_vary:
|
i = i+1
|
||||||
|
webru_url, Referer_webru_url,Origin_webru_url = await webru(id,"vary",client)
|
||||||
|
if MFP== "1":
|
||||||
|
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'
|
||||||
|
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 id in webru_dlhd:
|
||||||
|
if DLHD == "1":
|
||||||
i = i+1
|
i = i+1
|
||||||
webru_url = await webru(id,"vary",client)
|
webru_url_2,Referer_webru_url_2,Origin_webru_url_2 = await webru(id,"dlhd",client)
|
||||||
streams['streams'].append({'title': f"{Icon}Server X-{i} " + channel['title'],'url': webru_url})
|
if MFP== "1":
|
||||||
if id in webru_dlhd:
|
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'
|
||||||
if DLHD == "1":
|
streams['streams'].append({'title': f"{Icon}Proxied Server D-{i} " + channel['title'],'url': webru_url_2})
|
||||||
i = i+1
|
else:
|
||||||
webru_url_2,Referer_webru_url_2,Origin_webru_url_2 = await webru(id,"dlhd",client)
|
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 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}Proxied 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"}}}})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -306,7 +310,7 @@ async def addon_stream(request: Request,config, type, id,):
|
|||||||
|
|
||||||
streams['streams'].append({"name":f'{Name}\n{quality_sc} Max', 'title': f'{Icon}StreamingCommunity\n {slug_sc.replace("-"," ").capitalize()}','url': url_streaming_community,'behaviorHints':{'notWebReady': False, 'bingeGroup': f'streamingcommunity{quality_sc}'}})
|
streams['streams'].append({"name":f'{Name}\n{quality_sc} Max', 'title': f'{Icon}StreamingCommunity\n {slug_sc.replace("-"," ").capitalize()}','url': url_streaming_community,'behaviorHints':{'notWebReady': False, 'bingeGroup': f'streamingcommunity{quality_sc}'}})
|
||||||
else:
|
else:
|
||||||
streams['streams'].append({"name":f'{Name}\n{quality_sc}p Max\n This will work only on a local instance', 'title': f'{Icon}StreamingCommunity\n {slug_sc.replace("-"," ").capitalize()}','url': url_streaming_community,'behaviorHints': {'proxyHeaders': {"request": {"user-agent": User_Agent}}, 'notWebReady': True, 'bingeGroup': f'streamingcommunity{quality_sc}'}})
|
streams['streams'].append({"name":f'{Name}\n{quality_sc}p Max', 'title': f'{Icon}StreamingCommunity\n {slug_sc.replace("-"," ").capitalize()}\n This will work only on a local instance','url': url_streaming_community,'behaviorHints': {'proxyHeaders': {"request": {"user-agent": User_Agent}}, 'notWebReady': True, 'bingeGroup': f'streamingcommunity{quality_sc}'}})
|
||||||
|
|
||||||
if provider_maps['LORDCHANNEL'] == "1" and LC == "1":
|
if provider_maps['LORDCHANNEL'] == "1" and LC == "1":
|
||||||
url_lordchannel,quality_lordchannel = await lordchannel(id,client)
|
url_lordchannel,quality_lordchannel = await lordchannel(id,client)
|
||||||
|
|||||||
Reference in New Issue
Block a user