From 8dedb34b95777357db6cf2ec3aea5a7cc37b2281 Mon Sep 17 00:00:00 2001 From: UrloMythus Date: Sun, 16 Feb 2025 20:59:07 +0100 Subject: [PATCH] Added MFP support for SC, Fixed DDL appearing randomly --- Src/API/streamingcommunity.py | 35 ++++++++++++++++++++--------------- Src/Utilities/m3u8.py | 14 ++++++++++---- run.py | 21 +++++++++------------ static/static.py | 23 ++++++++++++----------- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/Src/API/streamingcommunity.py b/Src/API/streamingcommunity.py index 96f7898..3ea0ba7 100644 --- a/Src/API/streamingcommunity.py +++ b/Src/API/streamingcommunity.py @@ -53,7 +53,6 @@ else: SC_DOMAIN = config.SC_DOMAIN Public_Instance = config.Public_Instance Alternative_Link = env_vars.get('ALTERNATIVE_LINK') - headers = Headers() #GET VERSION OF STREAMING COMMUNITY: async def get_version(client): @@ -119,7 +118,7 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id): print("Couldn't find anything") -async def get_film(tid,version,client): +async def get_film(tid,version,client,MFP): random_headers = headers.generate() random_headers['Referer'] = "https://streamingcommunity.buzz/" random_headers['Origin'] = "https://streamingcommunity.buzz" @@ -129,6 +128,10 @@ async def get_film(tid,version,client): random_headers['user-agent'] = User_Agent #Access the iframe url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}' + if MFP == "1": + url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}' + 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') #Get the link of iframe @@ -175,13 +178,12 @@ async def get_film(tid,version,client): else: url = url + f"&token={token}" ''' - url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' - return url,url720,quality + return url,quality async def get_season_episode_id(tid,slug,season,episode,version,client): random_headers = headers.generate() - random_headers['Referer'] = "https://streamingcommunity.buzz/" - random_headers['Origin'] = "https://streamingcommunity.buzz" + random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" + random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}" random_headers['x-inertia'] = "true" random_headers['x-inertia-version'] = version @@ -194,7 +196,7 @@ async def get_season_episode_id(tid,slug,season,episode,version,client): if dict_episode['number'] == episode: return dict_episode['id'] -async def get_episode_link(episode_id,tid,version,client): +async def get_episode_link(episode_id,tid,version,client,MFP): #The parameters for the request random_headers = headers.generate() random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" @@ -207,6 +209,10 @@ async def get_episode_link(episode_id,tid,version,client): } #Let's try to get the link from iframe source # Make a request to get iframe source + if MFP == "1": + url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}?episode_id={episode_id}&next_episode=1' + quality = "Unknown" + return url,quality response = await client.get(ForwardProxy + f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies) # Parse response with BeautifulSoup to get iframe source @@ -250,11 +256,10 @@ async def get_episode_link(episode_id,tid,version,client): else: url = url + f"&token={token}" ''' - url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' - return url,url720,quality + return url,quality -async def streaming_community(imdb,client,SC_FAST_SEARCH): +async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP): try: ''' if Public_Instance == "1": @@ -319,15 +324,15 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH): tid,slug,version = await search(query,date,ismovie,client,SC_FAST_SEARCH,imdb_id) if ismovie == 1: #TID means temporaly ID - url,url720,quality = await get_film(tid,version,client) + url,quality = await get_film(tid,version,client,MFP) print("MammaMia found results for StreamingCommunity") - return url,url720,quality,slug + return url,quality,slug if ismovie == 0: #Uid = URL ID episode_id = await get_season_episode_id(tid,slug,season,episode,version,client) - url,url720,quality = await get_episode_link(episode_id,tid,version,client) + url,quality = await get_episode_link(episode_id,tid,version,client,MFP) print("MammaMia found results for StreamingCommunity") - return url,url720,quality,slug + return url,quality,slug except Exception as e: print("MammaMia: StreamingCommunity failed",e) return None,None,None,None @@ -336,7 +341,7 @@ async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: # Replace with actual id, for example 'anime_id:episode' format - test_id = "tt6468322:1:1" # This is an example ID format + test_id = "tt1190634:4:5" # This is an example ID format results = await streaming_community(test_id, client,"0") print(results) diff --git a/Src/Utilities/m3u8.py b/Src/Utilities/m3u8.py index 88dd61a..d0bc881 100644 --- a/Src/Utilities/m3u8.py +++ b/Src/Utilities/m3u8.py @@ -99,11 +99,8 @@ async def clony_m3u8(segment: str, request: Request): print(full_url) raise HTTPException(status_code=404, detail="Requested variant not available.") m3u8_content = await fetch_m3u8(full_url) - ''' if "sc-u12" not in m3u8_content: m3u8_content = re.sub(r"https://sc-[a-zA-Z0-9]+-\d+.scws-content.net", "https://sc-u12-01.scws-content.net", m3u8_content) - ''' - #Test return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl') @router.api_route('/storage/enc.key') @@ -123,4 +120,13 @@ async def get_key(): response.status_code, response_headers ) -#r"https://sc-b1-([0-2][0-9]|30).scws-content.net", "https://sc-u9-01.scws-content.net", m3u8_content) \ No newline at end of file +#r"https://sc-b1-([0-2][0-9]|30).scws-content.net", "https://sc-u9-01.scws-content.net", m3u8_content) + + +''' + forwarded_proto = request.headers.get("x-forwarded-proto") + scheme = forwarded_proto if forwarded_proto else request.url.scheme + instance_url = f"{scheme}://{request.url.netloc}" + url_streaming_community = url_streaming_community.replace("?","&") + url_streaming_community = instance_url + "/vixcloud/manifest.m3u8?d=" + url_streaming_community +''' \ No newline at end of file diff --git a/run.py b/run.py index 497b1da..43adc4d 100644 --- a/run.py +++ b/run.py @@ -290,20 +290,17 @@ async def addon_stream(request: Request,config, type, id,): streams['streams'].append({'title': f'{Icon}Mysterious {resolution}', 'url': link, 'behaviorHints': {'bingeGroup': f'mysterius{resolution}'}}) if provider_maps['STREAMINGCOMMUNITY'] == "1" and SC == "1": SC_FAST_SEARCH = provider_maps['SC_FAST_SEARCH'] - url_streaming_community,url_720_streaming_community,quality_sc, slug_sc = await streaming_community(id,client,SC_FAST_SEARCH) + 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 Remote_Instance == "1": - forwarded_proto = request.headers.get("x-forwarded-proto") - scheme = forwarded_proto if forwarded_proto else request.url.scheme - instance_url = f"{scheme}://{request.url.netloc}" - url_streaming_community = url_streaming_community.replace("?","&") - 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}'}}) + if MFP == "1" and "iframe" in url_streaming_community: + url_streaming_community = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url_streaming_community}&host=VixCloud&redirect_stream=true' + 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}\n{quality_sc} 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: - 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\n This will work only on a local instance', '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": url_lordchannel,quality_lordchannel = await lordchannel(id,client) @@ -339,7 +336,7 @@ async def addon_stream(request: Request,config, type, id,): if url_streamingwatch: print(f"StreamingWatch Found Results for {id}") streams['streams'].append({'name': f"{Name}\n720/1080p",'title': f'{Icon}StreamingWatch', 'url': url_streamingwatch, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": Referer}}, 'notWebReady': True, 'bingeGroup': 'streamingwatch'}}) - if provider_maps['DDLSTREAM'] and DDL == "1": + if provider_maps['DDLSTREAM'] == "1" and DDL == "1": if MFP == "1": results = await ddlstream(id,client) if results: diff --git a/static/static.py b/static/static.py index e61de08..1f66e7d 100644 --- a/static/static.py +++ b/static/static.py @@ -20,7 +20,7 @@ HTML = """ font-size: 2.2vh; font-family: 'Open Sans', Arial, sans-serif; color: white; - background: url('https://i.postimg.cc/m2ZqvpZj/italian-seamless-free-vector-pattern3.png') center center repeat; + background: url('https://i.postimg.cc/ry3p76HY/italian-seamless-free-vector-pattern3.png') center center repeat; background-size: cover; display: flex; align-items: flex-start; @@ -187,16 +187,6 @@ HTML = """

Configure your providers: Note that if you enable Fast Search results will be less accurate but faster

Select Providers:

-
- - - - -
+

To use the following provider you need to use a local instance or else you need to set up Mediaflow-proxy with an IP not blocked by the site

+
+ + + + +