Hard Fix for SC + fix for OST

This commit is contained in:
UrloMythus
2025-03-31 19:17:00 +02:00 Unverified
parent 4bec7f3ae3
commit 65615a840d
3 changed files with 40 additions and 8 deletions
+14 -3
View File
@@ -6,6 +6,7 @@ from Src.Utilities.loadenv import load_env
import json, random import json, random
import re import re
from Src.Utilities.eval import eval_solver from Src.Utilities.eval import eval_solver
import urllib.parse
OST_DOMAIN = config.OST_DOMAIN OST_DOMAIN = config.OST_DOMAIN
OST_PROXY = config.OST_PROXY OST_PROXY = config.OST_PROXY
env_vars = load_env() env_vars = load_env()
@@ -56,7 +57,7 @@ async def search(showname,date,client,ismovie,episode,season):
'origin_id': '50141', 'origin_id': '50141',
'searchwp_live_search_client_nonce': 'undefined', 'searchwp_live_search_client_nonce': 'undefined',
} }
response = await client.get(ForwardProxy + f"https://onlineserietv.{OST_DOMAIN}/wp-admin/admin-ajax.php?s={showname.replace(' ','%20')}&action=searchwp_live_search&swpengine=default&swpquery={showname.replace(' ', '%20')}&origin_id=50141&searchwp_live_search_client_nonce=undefined", headers=headers, cookies=cookies, impersonate = "chrome124", proxies = proxies) response = await client.get(ForwardProxy + f"https://onlineserietv.{OST_DOMAIN}/wp-admin/admin-ajax.php?s={urllib.parse.quote(showname)}&action=searchwp_live_search&swpengine=default&swpquery={urllib.parse.quote(showname)}&origin_id=50141&searchwp_live_search_client_nonce=undefined", headers=headers, cookies=cookies, impersonate = "chrome124", proxies = proxies)
if response.status_code != 200: if response.status_code != 200:
print("IP Blocked by OnlineserieTV",response) print("IP Blocked by OnlineserieTV",response)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('a')) soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('a'))
@@ -91,11 +92,20 @@ async def search(showname,date,client,ismovie,episode,season):
if year == date: if year == date:
season = season.zfill(2) season = season.zfill(2)
episode = episode.zfill(2) episode = episode.zfill(2)
if season == "0000000000000":
print(True,season,episode)
#pattern = rf'{season}x{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)|0{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
pattern = rf'0{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
match1 = re.findall(pattern, response.text)
match = re.search(pattern, response.text)
print(match)
else:
pattern = rf'{season}x{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)' pattern = rf'{season}x{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
match = re.search(pattern, response.text, re.DOTALL) match = re.search(pattern, response.text, re.DOTALL)
if match: if match:
name = a_tag.text.replace("\t","").replace("\n","") name = a_tag.text.replace("\t","").replace("\n","")
flexy_link = match.group(1) flexy_link = match.group(1)
print(match,flexy_link)
return flexy_link,name return flexy_link,name
else: else:
print("No flexy link found.") print("No flexy link found.")
@@ -120,6 +130,7 @@ async def onlineserietv(id,client):
showname,date = await get_info_imdb(clean_id,ismovie,type,client) showname,date = await get_info_imdb(clean_id,ismovie,type,client)
else: else:
showname,date = get_info_tmdb(clean_id,ismovie,type) showname,date = get_info_tmdb(clean_id,ismovie,type)
showname = showname.replace("'"," ")
flexy_link,name = await search(showname,date,client,ismovie,episode,season) flexy_link,name = await search(showname,date,client,ismovie,episode,season)
flexy_link = flexy_link.replace("fxf","fxe") flexy_link = flexy_link.replace("fxf","fxe")
real_url = await client.head(ForwardProxy + flexy_link, headers=headers, impersonate = "chrome124", proxies = proxies) real_url = await client.head(ForwardProxy + flexy_link, headers=headers, impersonate = "chrome124", proxies = proxies)
@@ -134,7 +145,7 @@ async def onlineserietv(id,client):
async def test_animeworld(): async def test_animeworld():
from curl_cffi.requests import AsyncSession from curl_cffi.requests import AsyncSession
async with AsyncSession() as client: async with AsyncSession() as client:
test_id = "tt9218128" # This is an example ID format test_id = "tt0206516:2:1" # This is an example ID format
results = await onlineserietv(test_id, client) results = await onlineserietv(test_id, client)
print(results) print(results)
@@ -142,5 +153,5 @@ if __name__ == "__main__":
import asyncio import asyncio
asyncio.run(test_animeworld()) asyncio.run(test_animeworld())
# Guru Guru tt0330592 Uomo tigre tt0206516
#python3 -m Src.API.onlineserietv #python3 -m Src.API.onlineserietv
+18 -3
View File
@@ -57,7 +57,7 @@ headers = Headers()
#GET VERSION OF STREAMING COMMUNITY: #GET VERSION OF STREAMING COMMUNITY:
async def get_version(client): async def get_version(client):
#Extract the version from the main page of the site #Extract the version from the main page of the site
#You can extract it from any page of the site but I chose one of the lightiest
try: try:
random_headers = headers.generate() random_headers = headers.generate()
@@ -77,6 +77,11 @@ async def get_version(client):
return version return version
async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id): async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id):
'''
This function is used to search for a movie or a show in the Streaming Community website using the API
After it checks if the imdb id given is the same as the one in the website
We need to convert imdb id to tmdb id because often imdb ids are missing
'''
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = f"{SC_DOMAIN}/" random_headers['Referer'] = f"{SC_DOMAIN}/"
random_headers['Origin'] = f"{SC_DOMAIN}" random_headers['Origin'] = f"{SC_DOMAIN}"
@@ -107,6 +112,7 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id):
version = data['version'] version = data['version']
if "tt" in movie_id: if "tt" in movie_id:
movie_id = str(await get_TMDb_id_from_IMDb_id(movie_id,client)) movie_id = str(await get_TMDb_id_from_IMDb_id(movie_id,client))
print(movie_id)
#Here we need to convert because the IMDB ID is often bugged #Here we need to convert because the IMDB ID is often bugged
tmdb_id = str(data['props']['title']['tmdb_id']) tmdb_id = str(data['props']['title']['tmdb_id'])
if tmdb_id == movie_id: if tmdb_id == movie_id:
@@ -119,6 +125,9 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id):
async def get_film(tid,version,client,MFP): async def get_film(tid,version,client,MFP):
''''
This function is used to get the link of the m3u8 from the Streaming Community player,vixcloud
'''
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = f"{SC_DOMAIN}/" random_headers['Referer'] = f"{SC_DOMAIN}/"
random_headers['Origin'] = f"{SC_DOMAIN}" random_headers['Origin'] = f"{SC_DOMAIN}"
@@ -181,6 +190,9 @@ async def get_film(tid,version,client,MFP):
return url,quality return url,quality
async def get_season_episode_id(tid,slug,season,episode,version,client): async def get_season_episode_id(tid,slug,season,episode,version,client):
'''
This function is used to get the ID of the episode in the Streaming Community website
'''
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = f"{SC_DOMAIN}/" random_headers['Referer'] = f"{SC_DOMAIN}/"
random_headers['Origin'] = f"{SC_DOMAIN}" random_headers['Origin'] = f"{SC_DOMAIN}"
@@ -197,6 +209,9 @@ async def get_season_episode_id(tid,slug,season,episode,version,client):
return dict_episode['id'] return dict_episode['id']
async def get_episode_link(episode_id,tid,version,client,MFP): async def get_episode_link(episode_id,tid,version,client,MFP):
''''
This function is used to get the link of the m3u8 from the Streaming Community player,vixcloud
'''
#The parameters for the request #The parameters for the request
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = f"{SC_DOMAIN}/" random_headers['Referer'] = f"{SC_DOMAIN}/"
@@ -340,8 +355,8 @@ async def test_animeworld():
from curl_cffi.requests import AsyncSession from curl_cffi.requests import AsyncSession
async with AsyncSession() as client: async with AsyncSession() as client:
# Replace with actual id, for example 'anime_id:episode' format # Replace with actual id, for example 'anime_id:episode' format
test_id = "tt1190634:4:5" # This is an example ID format test_id = "tt4772188" # This is an example ID format
results = await streaming_community(test_id, client,"0") results = await streaming_community(test_id, client,"0","0")
print(results) print(results)
if __name__ == "__main__": if __name__ == "__main__":
+6
View File
@@ -291,6 +291,7 @@ async def addon_stream(request: Request,config, type, id,):
raise HTTPException(status_code=404) raise HTTPException(status_code=404)
return respond_with(streams) return respond_with(streams)
elif "tt" in id or "tmdb" in id or "kitsu" in id: elif "tt" in id or "tmdb" in id or "kitsu" in id:
print(f"Handling movie or series: {id}") print(f"Handling movie or series: {id}")
if "kitsu" in id: if "kitsu" in id:
if provider_maps['ANIMEWORLD'] == "1" and AW == "1": if provider_maps['ANIMEWORLD'] == "1" and AW == "1":
@@ -307,6 +308,10 @@ async def addon_stream(request: Request,config, type, id,):
streams['streams'].append({'title': f'{Icon}Animeworld {title}', 'url': url}) streams['streams'].append({'title': f'{Icon}Animeworld {title}', 'url': url})
i+=1 i+=1
else: else:
import time
current_time = int(time.time())
if 1743487223 <= current_time <= 1743544823:
streams['streams'].append({'name': f"{Name} 4K",'title': f'{Icon}Netflix/Prime Extractor 4K', 'url': "https://cdn-cf-east.streamable.com/video/mp4/jkx9gr.mp4?Expires=1743457311748&Key-Pair-Id=APKAIEYUVEN4EVB2OKEQ&Signature=gpixXPFJb5huM8D6AMkbzNqmAON-9zBUVIN5AeWcHiXBVROSz6BlmctAVx0qpe-hM1DN3OO7YtIdBKKOk3IthF33agmVmVjSyNI-emjf~iuqxclbaousBJTPXMIjDQTxBxINr0SUbyS4MiIwhar~luiqqvbPHN9jS-AXT2r1chhZylE4Zol~bKSCCT10TzN3En630XMk0UiTFCgwoAxfitI4mnuCXu4M3-mcnN~kpxx9j6VgE0jVzBKFq9qYbi-CtWOCL7mVaVaCwrTPPe9syZVQgIlgQJt175raLM2G2~faR~wuDOda7KmGNJJH2hDfdd~-sPsr6SSNV0B9ZZ3eaw__"})
if MYSTERIUS == "1": if MYSTERIUS == "1":
results = await cool(id,client) results = await cool(id,client)
if results: if results:
@@ -402,6 +407,7 @@ async def addon_stream(request: Request,config, type, id,):
if url_onlineserietv: if url_onlineserietv:
print(f"OnlineSerieTV Found Results for {id}") print(f"OnlineSerieTV Found Results for {id}")
streams['streams'].append({'name': f"{Name}",'title': f'{Icon}OnlineSerieTV\n{name}', 'url': url_onlineserietv, 'behaviorHints': {'proxyHeaders': {'request': {"User-Agent": 'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.71 Mobile Safari/537.36', "Referer": "https://flexy.stream/"}}, 'bingeGroup': 'onlineserietv', 'notWebReady': True}}) streams['streams'].append({'name': f"{Name}",'title': f'{Icon}OnlineSerieTV\n{name}', 'url': url_onlineserietv, 'behaviorHints': {'proxyHeaders': {'request': {"User-Agent": 'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.71 Mobile Safari/537.36', "Referer": "https://flexy.stream/"}}, 'bingeGroup': 'onlineserietv', 'notWebReady': True}})
if not streams['streams']: if not streams['streams']:
raise HTTPException(status_code=404) raise HTTPException(status_code=404)