Improved Guardaserie, and added back support for SC domain
This commit is contained in:
+22
-3
@@ -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)
|
||||
|
||||
@@ -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,34 +303,13 @@ async def get_episode_link(episode_id,tid,version,client,MFP):
|
||||
return 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")
|
||||
async def streamingcommunity_site(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
|
||||
imdb_id = general[1]
|
||||
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,""
|
||||
except Exception as e:
|
||||
print("MammaMia: StreamingCommunity failed",e)
|
||||
return None,None,None
|
||||
|
||||
'''
|
||||
#Check if fast search is enabled or disabled
|
||||
if SC_FAST_SEARCH == "1":
|
||||
type = "StreamingCommunityFS"
|
||||
@@ -368,7 +348,6 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
|
||||
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}'
|
||||
@@ -383,9 +362,42 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
|
||||
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 "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
|
||||
|
||||
'''
|
||||
|
||||
'''
|
||||
async def test_animeworld():
|
||||
from curl_cffi.requests import AsyncSession
|
||||
|
||||
@@ -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}'}})
|
||||
|
||||
Reference in New Issue
Block a user