Improved Guardaserie, and added back support for SC domain

This commit is contained in:
UrloMythus
2025-06-15 19:03:38 +02:00 Unverified
parent 3d87ac1da8
commit edc3ad82b0
3 changed files with 112 additions and 84 deletions
+22 -3
View File
@@ -8,6 +8,7 @@ import json, random
from Src.Utilities.info import get_info_imdb,get_info_tmdb
from Src.Utilities.eval import eval_solver
import urllib.parse
from Src.Utilities.convert import get_IMDB_id_from_TMDb_id
env_vars = load_env()
GS_PROXY = config.GS_PROXY
proxies = {}
@@ -64,9 +65,19 @@ async def get_supervideo_link(link,client):
async def search_imdb(clean_id,client):
try:
headers = random_headers.generate()
response = await client.get(ForwardProxy + f'{GS_DOMAIN}/?story={clean_id}&do=search&subaction=search', allow_redirects=True, impersonate = "chrome124", headers = headers, proxies = proxies)
if response.status_code != 200:
print(f"Guardaserie Failed to fetch search results: {response.status_code}")
soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('div',class_="mlnh-2"))
div_mlnh2 = soup.select_one('div.mlnh-2:nth-of-type(2)')
a_tag = div_mlnh2.find('h2').find('a')
href = a_tag['href']
return href
except Exception as e:
return None
async def search(showname,date,client):
try:
@@ -112,6 +123,10 @@ async def guardaserie(id,client):
clean_id = general[1]
season = general[2]
episode = general[3]
if "tt" not in clean_id:
clean_id = await get_IMDB_id_from_TMDb_id(clean_id,client)
print(clean_id)
'''
type = "Guardaserie"
if "tt" in id:
showname,date = await get_info_imdb(clean_id,ismovie,type,client)
@@ -120,9 +135,13 @@ async def guardaserie(id,client):
showname = showname.replace("'"," ")
if "Guru" in showname:
showname = showname.split("-")[0]
'''
if ismovie == 1:
return None
'''
page_url = await search(showname,date,client)
'''
page_url = await search_imdb(clean_id,client)
supervideo_link =await player_url(page_url,season,episode,client)
if supervideo_link:
final_url = await eval_solver(supervideo_link,proxies, ForwardProxy, client)
+90 -78
View File
@@ -114,6 +114,7 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id):
print(movie_id)
#Here we need to convert because the IMDB ID is often bugged
tmdb_id = str(data['props']['title']['tmdb_id'])
print(tmdb_id)
if tmdb_id == movie_id:
return tid,slug,version
elif SC_FAST_SEARCH == "1":
@@ -302,90 +303,101 @@ async def get_episode_link(episode_id,tid,version,client,MFP):
return url,quality
async def streamingcommunity_site(imdb,client,SC_FAST_SEARCH,MFP):
general = await is_movie(imdb)
ismovie = general[0]
imdb_id = general[1]
if ismovie == 0 :
season = int(general[2])
episode = int(general[3])
#Check if fast search is enabled or disabled
if SC_FAST_SEARCH == "1":
type = "StreamingCommunityFS"
if "tt" in imdb:
#Get showname
showname = await get_info_imdb(imdb_id,ismovie,type,client)
date = None
else:
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
date = None
#else just equals them
tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type)
elif SC_FAST_SEARCH == "0":
type = "StreamingCommunity"
if "tt" in imdb:
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
showname,date = get_info_tmdb(tmdba,ismovie,type)
#HERE THE CASE IF IT IS A MOVIE
else:
if SC_FAST_SEARCH == "1":
type = "StreamingCommunityFS"
if "tt" in imdb:
#Get showname
date = None
showname = await get_info_imdb(imdb_id,ismovie,type,client)
else:
date = None
tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type)
elif SC_FAST_SEARCH == "0":
type = "StreamingCommunity"
if "tt" in imdb:
#Get showname
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
else:
tmdba = imdb_id.replace("tmdb:","")
showname,date = get_info_tmdb(tmdba,ismovie,type)
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
showname = urllib.parse.quote_plus(showname)
query = f'{SC_DOMAIN}/api/search?q={showname}'
tid,slug,version = await search(query,date,ismovie,client,SC_FAST_SEARCH,imdb_id)
if ismovie == 1:
#TID means temporaly ID
url,quality = await get_film(tid,version,client,MFP)
print("MammaMia found results for StreamingCommunity")
return url,quality,slug
if ismovie == 0:
#Uid = URL ID
episode_id = await get_season_episode_id(tid,slug,season,episode,version,client)
url,quality = await get_episode_link(episode_id,tid,version,client,MFP)
return url,quality,slug
async def vixsrc(imdb,client,SC_FAST_SEARCH,MFP):
general = await is_movie(imdb)
ismovie = general[0]
id = general[1]
if "tt" in imdb:
tmdb = await get_TMDb_id_from_IMDb_id(id,client)
else:
tmdb = id
if ismovie == 0 :
season = int(general[2])
episode = int(general[3])
site_url = f'{SC_DOMAIN}/tv/{tmdb}/{general[2]}/{general[3]}/'
else:
site_url = f'{SC_DOMAIN}/movie/{tmdb}/'
if MFP == "1":
quality = "Unknown"
return site_url,quality,""
else:
full_url,quality = await extractor(site_url,client)
return full_url,quality,""
async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
try:
if "streaming" in SC_DOMAIN:
print("Please insert vixsrc site/Perfavore inserisci il sito di vixsrc")
general = await is_movie(imdb)
ismovie = general[0]
id = general[1]
if "tt" in imdb:
tmdb = await get_TMDb_id_from_IMDb_id(id,client)
else:
tmdb = id
if ismovie == 0 :
season = int(general[2])
episode = int(general[3])
site_url = f'{SC_DOMAIN}/tv/{tmdb}/{general[2]}/{general[3]}/'
else:
site_url = f'{SC_DOMAIN}/movie/{tmdb}/'
if MFP == "1":
quality = "Unknown"
return site_url,quality,""
else:
full_url,quality = await extractor(site_url,client)
return full_url,quality,""
if "vixsrc" in SC_DOMAIN:
url,quality,slug = await vixsrc(imdb,client,SC_FAST_SEARCH,MFP)
elif "streaming" in SC_DOMAIN:
url,quality,slug = await streamingcommunity_site(imdb,client,SC_FAST_SEARCH,MFP)
return url,quality,slug
except Exception as e:
print("MammaMia: StreamingCommunity failed",e)
print("StreamingCommunity failed",e)
return None,None,None
'''
#Check if fast search is enabled or disabled
if SC_FAST_SEARCH == "1":
type = "StreamingCommunityFS"
if "tt" in imdb:
#Get showname
showname = await get_info_imdb(imdb_id,ismovie,type,client)
date = None
else:
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
date = None
#else just equals them
tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type)
elif SC_FAST_SEARCH == "0":
type = "StreamingCommunity"
if "tt" in imdb:
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
showname,date = get_info_tmdb(tmdba,ismovie,type)
#HERE THE CASE IF IT IS A MOVIE
else:
if SC_FAST_SEARCH == "1":
type = "StreamingCommunityFS"
if "tt" in imdb:
#Get showname
date = None
showname = await get_info_imdb(imdb_id,ismovie,type,client)
else:
date = None
tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type)
elif SC_FAST_SEARCH == "0":
type = "StreamingCommunity"
if "tt" in imdb:
#Get showname
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
else:
tmdba = imdb_id.replace("tmdb:","")
showname,date = get_info_tmdb(tmdba,ismovie,type)
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
showname = urllib.parse.quote_plus(showname)
query = f'{SC_DOMAIN}/api/search?q={showname}'
tid,slug,version = await search(query,date,ismovie,client,SC_FAST_SEARCH,imdb_id)
if ismovie == 1:
#TID means temporaly ID
url,quality = await get_film(tid,version,client,MFP)
print("MammaMia found results for StreamingCommunity")
return url,quality,slug
if ismovie == 0:
#Uid = URL ID
episode_id = await get_season_episode_id(tid,slug,season,episode,version,client)
url,quality = await get_episode_link(episode_id,tid,version,client,MFP)
return url,quality,slug
except Exception as e:
print("MammaMia: StreamingCommunity failed",e)
return None,None,None
'''
async def test_animeworld():
from curl_cffi.requests import AsyncSession
-3
View File
@@ -326,9 +326,6 @@ async def addon_stream(request: Request,config, type, id,):
if MFP == "1":
url_streaming_community = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url_streaming_community}&host=VixCloud&redirect_stream=false'
url_streaming_community = await transform_mfp(url_streaming_community,client)
if "hf.space" in MFP_url:
streams['streams'].append({"name":f'{Name}', 'title': f'{Icon}StreamingCommunity\n Sorry StreamingCommunity wont work, most likely, with MFP hosted on HuggingFace','url': url_streaming_community})
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:
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}'}})