Vixsrc support added, please use that site in the config
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from bs4 import BeautifulSoup,SoupStrainer
|
||||
from Src.Utilities.convert import get_TMDb_id_from_IMDb_id
|
||||
from Src.Utilities.info import get_info_tmdb, is_movie, get_info_imdb
|
||||
import Src.Utilities.config as config
|
||||
@@ -138,7 +138,7 @@ async def get_film(tid,version,client,MFP):
|
||||
url = f'{SC_DOMAIN}/it/iframe/{tid}'
|
||||
if MFP == "1":
|
||||
url = f'{SC_DOMAIN}/it/iframe/{tid}'
|
||||
quality = "Unknown"
|
||||
quality = "Unknown"
|
||||
return url,quality
|
||||
response = await client.get(ForwardProxy + url, headers=random_headers, allow_redirects=True,impersonate = "chrome124", proxies = proxies)
|
||||
iframe = BeautifulSoup(response.text, 'lxml')
|
||||
@@ -209,6 +209,33 @@ async def get_season_episode_id(tid,slug,season,episode,version,client):
|
||||
if dict_episode['number'] == episode:
|
||||
return dict_episode['id']
|
||||
|
||||
|
||||
|
||||
async def extractor(link,client):
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = f"{SC_DOMAIN}/"
|
||||
random_headers['Origin'] = f"{SC_DOMAIN}"
|
||||
random_headers['User-Agent'] = User_Agent
|
||||
random_headers['user-agent'] = User_Agent
|
||||
response = await client.get(link)
|
||||
if response.status_code != 200:
|
||||
print("Failed to extract URL components, Invalid Request")
|
||||
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer("body"))
|
||||
if soup:
|
||||
script = soup.find("body").find("script").text
|
||||
token = re.search(r"'token':\s*'(\w+)'", script).group(1)
|
||||
expires = re.search(r"'expires':\s*'(\d+)'", script).group(1)
|
||||
server_url = re.search(r"url:\s*'([^']+)'", script).group(1)
|
||||
quality = re.search(r'"quality":(\d+)', script).group(1)
|
||||
if "?b=1" in server_url:
|
||||
final_url = f'{server_url}&token={token}&expires={expires}'
|
||||
else:
|
||||
final_url = f"{server_url}?token={token}&expires={expires}"
|
||||
if "window.canPlayFHD = true" in script:
|
||||
final_url += "&h=1"
|
||||
return final_url,quality
|
||||
|
||||
|
||||
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
|
||||
@@ -277,24 +304,32 @@ async def get_episode_link(episode_id,tid,version,client,MFP):
|
||||
|
||||
async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
|
||||
try:
|
||||
'''
|
||||
if Public_Instance == "1":
|
||||
Weird_Link = json.loads(Alternative_Link)
|
||||
link_post = random.choice(Weird_Link)
|
||||
response = await client.get(f"{link_post}fetch-data/{SC_FAST_SEARCH}/{SC_DOMAIN}/{imdb}")
|
||||
url_streaming_community = response.headers.get('x-url-streaming-community')
|
||||
url_720_streaming_community = response.headers.get('x-url-720-streaming-community')
|
||||
quality_sc = response.headers.get('x-quality-sc')
|
||||
print(quality_sc,url_streaming_community)
|
||||
return url_streaming_community,url_720_streaming_community,quality_sc
|
||||
'''
|
||||
if "streaming" in SC_DOMAIN:
|
||||
print("Please insert vixsrc site/Perfavore inserisci il sito di vixsrc")
|
||||
general = await is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
|
||||
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,""
|
||||
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"
|
||||
@@ -351,7 +386,7 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
|
||||
except Exception as e:
|
||||
print("MammaMia: StreamingCommunity failed",e)
|
||||
return None,None,None
|
||||
|
||||
'''
|
||||
async def test_animeworld():
|
||||
from curl_cffi.requests import AsyncSession
|
||||
async with AsyncSession() as client:
|
||||
@@ -362,4 +397,24 @@ async def test_animeworld():
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
asyncio.run(test_animeworld())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
if Public_Instance == "1":
|
||||
Weird_Link = json.loads(Alternative_Link)
|
||||
link_post = random.choice(Weird_Link)
|
||||
response = await client.get(f"{link_post}fetch-data/{SC_FAST_SEARCH}/{SC_DOMAIN}/{imdb}")
|
||||
url_streaming_community = response.headers.get('x-url-streaming-community')
|
||||
url_720_streaming_community = response.headers.get('x-url-720-streaming-community')
|
||||
quality_sc = response.headers.get('x-quality-sc')
|
||||
print(quality_sc,url_streaming_community)
|
||||
return url_streaming_community,url_720_streaming_community,quality_sc
|
||||
'''
|
||||
@@ -323,11 +323,11 @@ async def addon_stream(request: Request,config, type, id,):
|
||||
url_streaming_community,quality_sc, slug_sc = await streaming_community(id,client,SC_FAST_SEARCH,MFP)
|
||||
if url_streaming_community is not None:
|
||||
print(f"StreamingCommunity Found Results for {id}")
|
||||
if MFP == "1" and "iframe" in url_streaming_community:
|
||||
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 with MFP hosted on HuggingFace','url': url_streaming_community})
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user