Added MFP support for SC, Fixed DDL appearing randomly

This commit is contained in:
UrloMythus
2025-02-16 20:59:07 +01:00 Unverified
parent 08746b47e2
commit 2a959da071
4 changed files with 51 additions and 42 deletions
+20 -15
View File
@@ -53,7 +53,6 @@ else:
SC_DOMAIN = config.SC_DOMAIN SC_DOMAIN = config.SC_DOMAIN
Public_Instance = config.Public_Instance Public_Instance = config.Public_Instance
Alternative_Link = env_vars.get('ALTERNATIVE_LINK') Alternative_Link = env_vars.get('ALTERNATIVE_LINK')
headers = Headers() headers = Headers()
#GET VERSION OF STREAMING COMMUNITY: #GET VERSION OF STREAMING COMMUNITY:
async def get_version(client): 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") 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 = headers.generate()
random_headers['Referer'] = "https://streamingcommunity.buzz/" random_headers['Referer'] = "https://streamingcommunity.buzz/"
random_headers['Origin'] = "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 random_headers['user-agent'] = User_Agent
#Access the iframe #Access the iframe
url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}' 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) response = await client.get(ForwardProxy + url, headers=random_headers, allow_redirects=True,impersonate = "chrome124", proxies = proxies)
iframe = BeautifulSoup(response.text, 'lxml') iframe = BeautifulSoup(response.text, 'lxml')
#Get the link of iframe #Get the link of iframe
@@ -175,13 +178,12 @@ async def get_film(tid,version,client):
else: else:
url = url + f"&token={token}" url = url + f"&token={token}"
''' '''
url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' return url,quality
return url,url720,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):
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = "https://streamingcommunity.buzz/" random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/"
random_headers['Origin'] = "https://streamingcommunity.buzz" random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}"
random_headers['x-inertia'] = "true" random_headers['x-inertia'] = "true"
random_headers['x-inertia-version'] = version 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: if dict_episode['number'] == episode:
return dict_episode['id'] 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 #The parameters for the request
random_headers = headers.generate() random_headers = headers.generate()
random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" 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 #Let's try to get the link from iframe source
# Make a request to get 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) 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 # Parse response with BeautifulSoup to get iframe source
@@ -250,11 +256,10 @@ async def get_episode_link(episode_id,tid,version,client):
else: else:
url = url + f"&token={token}" url = url + f"&token={token}"
''' '''
url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' return url,quality
return url,url720,quality
async def streaming_community(imdb,client,SC_FAST_SEARCH): async def streaming_community(imdb,client,SC_FAST_SEARCH,MFP):
try: try:
''' '''
if Public_Instance == "1": 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) tid,slug,version = await search(query,date,ismovie,client,SC_FAST_SEARCH,imdb_id)
if ismovie == 1: if ismovie == 1:
#TID means temporaly ID #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") print("MammaMia found results for StreamingCommunity")
return url,url720,quality,slug return url,quality,slug
if ismovie == 0: if ismovie == 0:
#Uid = URL ID #Uid = URL ID
episode_id = await get_season_episode_id(tid,slug,season,episode,version,client) 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") print("MammaMia found results for StreamingCommunity")
return url,url720,quality,slug return url,quality,slug
except Exception as e: except Exception as e:
print("MammaMia: StreamingCommunity failed",e) print("MammaMia: StreamingCommunity failed",e)
return None,None,None,None return None,None,None,None
@@ -336,7 +341,7 @@ 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 = "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") results = await streaming_community(test_id, client,"0")
print(results) print(results)
+10 -4
View File
@@ -99,11 +99,8 @@ async def clony_m3u8(segment: str, request: Request):
print(full_url) print(full_url)
raise HTTPException(status_code=404, detail="Requested variant not available.") raise HTTPException(status_code=404, detail="Requested variant not available.")
m3u8_content = await fetch_m3u8(full_url) m3u8_content = await fetch_m3u8(full_url)
'''
if "sc-u12" not in m3u8_content: 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) 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') return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
@router.api_route('/storage/enc.key') @router.api_route('/storage/enc.key')
@@ -123,4 +120,13 @@ async def get_key():
response.status_code, response.status_code,
response_headers response_headers
) )
#r"https://sc-b1-([0-2][0-9]|30).scws-content.net", "https://sc-u9-01.scws-content.net", m3u8_content) #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
'''
+9 -12
View File
@@ -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}'}}) streams['streams'].append({'title': f'{Icon}Mysterious {resolution}', 'url': link, 'behaviorHints': {'bingeGroup': f'mysterius{resolution}'}})
if provider_maps['STREAMINGCOMMUNITY'] == "1" and SC == "1": if provider_maps['STREAMINGCOMMUNITY'] == "1" and SC == "1":
SC_FAST_SEARCH = provider_maps['SC_FAST_SEARCH'] 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: if url_streaming_community is not None:
print(f"StreamingCommunity Found Results for {id}") print(f"StreamingCommunity Found Results for {id}")
if Remote_Instance == "1": if MFP == "1" and "iframe" in url_streaming_community:
forwarded_proto = request.headers.get("x-forwarded-proto") url_streaming_community = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url_streaming_community}&host=VixCloud&redirect_stream=true'
scheme = forwarded_proto if forwarded_proto else request.url.scheme if "hf.space" in MFP_url:
instance_url = f"{scheme}://{request.url.netloc}" streams['streams'].append({"name":f'{Name}', 'title': f'{Icon}StreamingCommunity\n Sorry StreamingCommunity wont work with MFP hosted on HuggingFace','url': url_streaming_community})
url_streaming_community = url_streaming_community.replace("?","&")
url_streaming_community = instance_url + "/vixcloud/manifest.m3u8?d=" + 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}'}})
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}'}})
else: 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": if provider_maps['LORDCHANNEL'] == "1" and LC == "1":
url_lordchannel,quality_lordchannel = await lordchannel(id,client) url_lordchannel,quality_lordchannel = await lordchannel(id,client)
@@ -339,7 +336,7 @@ async def addon_stream(request: Request,config, type, id,):
if url_streamingwatch: if url_streamingwatch:
print(f"StreamingWatch Found Results for {id}") 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'}}) 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": if MFP == "1":
results = await ddlstream(id,client) results = await ddlstream(id,client)
if results: if results:
+12 -11
View File
@@ -20,7 +20,7 @@ HTML = """
font-size: 2.2vh; font-size: 2.2vh;
font-family: 'Open Sans', Arial, sans-serif; font-family: 'Open Sans', Arial, sans-serif;
color: white; 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; background-size: cover;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
@@ -187,16 +187,6 @@ HTML = """
<p class="description">Configure your providers: Note that if you enable Fast Search results will be less accurate but faster</p> <p class="description">Configure your providers: Note that if you enable Fast Search results will be less accurate but faster</p>
<h3 class="gives">Select Providers:</h3> <h3 class="gives">Select Providers:</h3>
<form class="pure-form" id="provider-form"> <form class="pure-form" id="provider-form">
<div class="provider-group">
<label for="streamingcommunity" class="provider-label">
<input type="checkbox" id="streamingcommunity"> StreamingCommunity
</label>
<span class="fast-search">
<label for="fast_search_sc">
<input type="checkbox" id="fast_search_sc"> Fast Search
</label>
</span>
</div>
<div class="provider-group"> <div class="provider-group">
<label for="lordchannel" class="provider-label"> <label for="lordchannel" class="provider-label">
<input type="checkbox" id="lordchannel"> LordChannel <input type="checkbox" id="lordchannel"> LordChannel
@@ -255,6 +245,17 @@ HTML = """
<input type="checkbox" id="ddlstream"> DDLStream Italy <input type="checkbox" id="ddlstream"> DDLStream Italy
</label> </label>
</div> </div>
<p>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</p>
<div class="provider-group">
<label for="streamingcommunity" class="provider-label">
<input type="checkbox" id="streamingcommunity"> StreamingCommunity
</label>
<span class="fast-search">
<label for="fast_search_sc">
<input type="checkbox" id="fast_search_sc"> Fast Search
</label>
</span>
</div>
<div class="provider-group"> <div class="provider-group">
<label for="livetv" class="provider-label"> <label for="livetv" class="provider-label">
<input type="checkbox" id="livetv"> LiveTV <input type="checkbox" id="livetv"> LiveTV