New Version

This commit is contained in:
UrloMythus
2026-01-10 21:45:02 +01:00 Unverified
parent 97a65bf654
commit 4fd486b649
23 changed files with 787 additions and 98 deletions
+58 -23
View File
@@ -6,6 +6,8 @@ from fake_headers import Headers
import Src.Utilities.config as config
from Src.Utilities.loadenv import load_env
from Src.API.extractors.mixdrop import mixdrop
from Src.API.extractors.maxstream import maxstream
from Src.API.extractors.uprot import bypass_uprot
import logging
from Src.Utilities.config import setup_logging
level = config.LEVEL
@@ -13,6 +15,8 @@ logger = setup_logging(level)
CB_DOMAIN = config.CB_DOMAIN
CB_PROXY = config.CB_PROXY
MX_PROXY = config.MX_PROXY
Icon = config.Icon
Name = config.Name
proxies = {}
proxies2 = {}
env_vars = load_env()
@@ -70,7 +74,21 @@ async def get_stayonline(link,client):
real_url = response.json()['data']['value']
return real_url
async def get_maxstream(link,streams,client):
if 'stayonline' in link:
uprot_link = await get_stayonline(link,client)
else:
uprot_link = link
maxstream_link = await bypass_uprot(client,uprot_link)
if maxstream_link:
streams = await maxstream(maxstream_link,client,streams,'CB01','',proxies2,ForwardProxy)
else:
if maxstream_link == False:
return streams
else:
streams['streams'].append({'name': f"{Name}",'title': f'{Icon}CB01\n▶️ Please do the captcha at /uprot in order to be able to play this content! \n Remember to refresh the sources!\nIf you recently did the captcha then dont worry, just refresh the sources', 'url': 'https://github.com/UrloMythus/MammaMia', 'behaviorHints': { 'bingeGroup': 'cb01'}})
return streams
async def search_movie(showname,date,client):
try:
showname = showname.replace(" ","+").replace("ò","o").replace("è","e").replace("à","a").replace("ù","u").replace("ì","i")
@@ -94,7 +112,7 @@ async def search_movie(showname,date,client):
match = year_pattern.search(date_text)
if match:
year = match.group(0)
if year == date : # Check if the year is 2011
if year == date :
return href
except Exception as e:
logger.warning(f'MammaMia: Error in search_series cb01: {e}')
@@ -116,7 +134,6 @@ async def search_series(showname,date,client):
# Find the link inside the current card
link_tag = card.find('h3', class_='card-title').find('a')
href = link_tag['href']
# Find the date span and extract possible years
date_span = card.find('span', style=re.compile('color'))
if date_span:
@@ -125,7 +142,7 @@ async def search_series(showname,date,client):
match = year_pattern.search(date_text)
if match:
year = match.group(0)
if year == date : # Check if the year is 2011
if (int(year) - int(date)) == 0 or (int(year)-int(date)) == 1 or (int(year)-int(date)) == -1 : # Check if the year is 2011
return href
except Exception as e:
logger.warning(f'MammaMia: Error in search_series cb01: {e}')
@@ -136,35 +153,54 @@ async def movie_redirect_url(link,client,MFP,MFP_CREDENTIALS,streams):
# Extract the redirect URL from the HTML
soup = BeautifulSoup(response.text, "lxml",parse_only=SoupStrainer('div'))
redirect_url = soup.find("div", id="iframen2").get("data-src")
redirect_url_2 = soup.find("div", id="iframen1").get("data-src")
if "stayonline" in redirect_url:
mixdrop_real_link = await get_stayonline(redirect_url,client)
streams = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"")
streams,status = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"")
if status == False:
streams = await get_maxstream(redirect_url_2,streams,client)
return streams
async def series_search_streams(text,search_text,response_text,headers,season,episode,client,MFP,MFP_CREDENTIALS,streams):
if "A" in text:
captcha = re.search(rf'{search_text}.*?href="([^"]+)',response_text,re.DOTALL)
if captcha:
response = await client.get(ForwardProxy + captcha.group(1), headers = headers, allow_redirects = True, proxies = proxies)
season = season.zfill(2)
match = re.search(rf"(S{season}E{episode}|{season}x{episode}).+?href='([^']+)",response.text)
print(match.group(2))
if match:
streams = await get_maxstream(match.group(2),streams,client)
else:
match = re.search(rf'{season}&#215;{episode}\s*&#8211;\s*<a[^>]*href="[^"]*"[^>]*>[^<]*</a>\s&#8211; <a[^>]*href="[^"]*',response_text)
if match:
links = match.group(0)
soup = BeautifulSoup(links,'lxml',parse_only=SoupStrainer('a'))
host_links = soup.find_all('a')
mixdrop_real_link = await get_stayonline(host_links[1]['href'],client)
status = False
#streams,status = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"")
if status == False:
streams = await get_maxstream(host_links[0]['href'],streams,client)
return streams
async def series_redirect_url(link,season,episode,client,MFP,MFP_CREDENTIALS,streams):
if len(episode) == 1:
episode = f'0{episode}'
episode = episode.zfill(2)
headers = fake_headers.generate()
response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True, timeout=10, proxies = proxies)
soup = BeautifulSoup(response.text, "lxml")
soup = BeautifulSoup(response.text, "lxml")
seasons_text = soup.find_all('div', class_='sp-head')
for season_text in seasons_text:
text = season_text.text
search_text = season_text.text
if f'STAGIONE' in text and f'{season}' in text:
text = text.replace("STAGIONE","").replace("ITA", "")
if "A" in text:
return streams
else:
episode = episode.zfill(2)
match = re.search(rf'{season}&#215;{episode}\s*&#8211;\s*<a[^>]*href="[^"]*"[^>]*>[^<]*</a>\s&#8211; <a[^>]*href="[^"]*',response.text)
if match:
links = match.group(0)
soup = BeautifulSoup(links,'lxml',parse_only=SoupStrainer('a'))
mixdrop_a = soup.find_all('a')[1]
mixdrop_link = mixdrop_a['href']
mixdrop_real_link = await get_stayonline(mixdrop_link,client)
streams = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"")
return streams
streams = await series_search_streams(text,search_text,response.text,headers,season,episode,client,MFP,MFP_CREDENTIALS,streams)
elif f'STAGIONE' in text and 'A' in text.replace("STAGIONE","").replace("ITA", ""):
parts = text.split('STAGIONE ')[1].split(' A ')
num1 = int(parts[0])
num2 = int(parts[1][0])
if int(season) in range(num1,num2):
streams = await series_search_streams(text,search_text,response.text,headers,season,episode,client,MFP,MFP_CREDENTIALS,streams)
return streams
@@ -219,8 +255,7 @@ async def cb01(streams,id,MFP,MFP_CREDENTIALS,client):
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 = "tt32360916:1:1" # This is an example ID format
test_id = "tt0158552:1:2" # This is an example ID format
MFP = "0"
results = await cb01({'streams': []},test_id,MFP,['test','test'],client)
print(results)