Fixed OkRu

This commit is contained in:
UrloMythus
2025-01-20 22:22:57 +01:00 Unverified
parent 57f05518e6
commit 09665512e4
2 changed files with 29 additions and 13 deletions
+18 -3
View File
@@ -1,14 +1,30 @@
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import json import json
from Src.Utilities.dictionaries import okru from Src.Utilities.dictionaries import okru
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'DNT': '1',
'Sec-GPC': '1',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Priority': 'u=1',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
async def okru_get_url(id,client): async def okru_get_url(id,client):
try: try:
embed_link = okru[id] embed_link = okru[id]
print(embed_link) response = await client.get(embed_link, allow_redirects=True, headers = headers, impersonate = "chrome124")
response = await client.get(embed_link, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
div = soup.find('div', {'data-module': 'OKVideo'}) div = soup.find('div', {'data-module': 'OKVideo'})
data_options = div.get('data-options') data_options = div.get('data-options')
@@ -16,7 +32,6 @@ async def okru_get_url(id,client):
metadata = json.loads(data['flashvars']['metadata']) metadata = json.loads(data['flashvars']['metadata'])
m3u8_link = metadata['hlsMasterPlaylistUrl'] m3u8_link = metadata['hlsMasterPlaylistUrl']
print("MammaMia: Found results for Okru") print("MammaMia: Found results for Okru")
print(m3u8_link)
return m3u8_link return m3u8_link
except Exception as e: except Exception as e:
print("MammaMia: No results found for Okru") print("MammaMia: No results found for Okru")
+11 -10
View File
@@ -23,6 +23,7 @@ from slowapi.middleware import SlowAPIMiddleware
from static.static import HTML from static.static import HTML
from urllib.parse import unquote from urllib.parse import unquote
from Src.Utilities.m3u8 import router as m3u8_clone from Src.Utilities.m3u8 import router as m3u8_clone
#Configure Env Vars #Configure Env Vars
Global_Proxy = config.Global_Proxy Global_Proxy = config.Global_Proxy
if Global_Proxy == "1": if Global_Proxy == "1":
@@ -201,7 +202,10 @@ async def addon_stream(request: Request,config, type, id,):
if type not in MANIFEST['types']: if type not in MANIFEST['types']:
raise HTTPException(status_code=404) raise HTTPException(status_code=404)
streams = {'streams': []} streams = {'streams': []}
config_providers = config.split('|') if "|" in config:
config_providers = config.split('|')
elif "%7C" in config:
config_providers = config.split('%7C')
provider_maps = {name: "0" for name in provider_map.values()} provider_maps = {name: "0" for name in provider_map.values()}
for provider in config_providers: for provider in config_providers:
if provider in provider_map: if provider in provider_map:
@@ -229,16 +233,11 @@ async def addon_stream(request: Request,config, type, id,):
streams['streams'].append({ streams['streams'].append({
'title': f"{Icon}Server {i} " + f" "+ channel['name'] + " " + channel['title'] , 'title': f"{Icon}Server {i} " + f" "+ channel['name'] + " " + channel['title'] ,
'url': channel['url'] 'url': channel['url']
}) })
'''
if id in okru: if id in okru:
i = i+1 i = i+1
channel_url = await okru_get_url(id,client) channel_url = await okru_get_url(id,client)
streams['streams'].append({ streams['streams'].append({'title': f"{Icon}Server {i} " + channel['title'] + " OKRU",'url': channel_url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": User_Agent}}}})
'title': f"{Icon}Server {i} " + channel['title'] + " OKRU",
'url': channel_url
})
'''
if id in extra_sources: if id in extra_sources:
list_sources = extra_sources[id] list_sources = extra_sources[id]
for item in list_sources: for item in list_sources:
@@ -301,11 +300,12 @@ async def addon_stream(request: Request,config, type, id,):
instance_url = f"{scheme}://{request.url.netloc}" instance_url = f"{scheme}://{request.url.netloc}"
url_streaming_community = url_streaming_community.replace("?","&") url_streaming_community = url_streaming_community.replace("?","&")
url_streaming_community = instance_url + "/vixcloud/manifest.m3u8?d=" + url_streaming_community url_streaming_community = instance_url + "/vixcloud/manifest.m3u8?d=" + url_streaming_community
if quality_sc == "1080":
quality_sc = quality_sc.replace("1080","720")
streams['streams'].append({"name":f'{Name}\n{quality_sc}p Max', 'title': f'{Icon}StreamingCommunity\n {slug_sc.replace("-"," ").capitalize()}','url': url_streaming_community,'behaviorHints': {'proxyHeaders': {"request": {"user-agent": User_Agent}}, 'notWebReady': False, '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()}','url': url_streaming_community,'behaviorHints': {'proxyHeaders': {"request": {"user-agent": User_Agent}}, 'notWebReady': False, 'bingeGroup': f'streamingcommunity{quality_sc}'}})
else: else:
streams['streams'].append({"name":f'{Name}\n{quality_sc}p Max', '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()}','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)
if quality_lordchannel == "FULL HD" and url_lordchannel != None: if quality_lordchannel == "FULL HD" and url_lordchannel != None:
@@ -319,6 +319,7 @@ async def addon_stream(request: Request,config, type, id,):
if url_filmpertutti is not None and Host is not None: if url_filmpertutti is not None and Host is not None:
if MFP == "1": if MFP == "1":
url_filmpertutti = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url_filmpertutti}&host={Host}&redirect_stream=true' url_filmpertutti = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url_filmpertutti}&host={Host}&redirect_stream=true'
print(url_filmpertutti)
streams['streams'].append({'name': f'{Name}', 'title': f'{Icon}Filmpertutti', 'url': url_filmpertutti,'behaviorHints': {'bingeGroup': 'filmpertutti'}}) streams['streams'].append({'name': f'{Name}', 'title': f'{Icon}Filmpertutti', 'url': url_filmpertutti,'behaviorHints': {'bingeGroup': 'filmpertutti'}})
else: else:
streams['streams'].append({'name': f'{Name}', 'title': f'{Icon}Filmpertutti', 'url': url_filmpertutti,'behaviorHints': {'proxyHeaders': {"request": {"User-Agent": "Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"}}, 'notWebReady': True, 'bingeGroup': 'filmpertutti'}}) streams['streams'].append({'name': f'{Name}', 'title': f'{Icon}Filmpertutti', 'url': url_filmpertutti,'behaviorHints': {'proxyHeaders': {"request": {"User-Agent": "Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"}}, 'notWebReady': True, 'bingeGroup': 'filmpertutti'}})