MammaMia version 2.0.0

This commit is contained in:
UrloMythus
2025-09-15 17:31:03 +02:00 Unverified
parent 87d5253580
commit 1ac0869350
47 changed files with 1513 additions and 1241 deletions
+154
View File
@@ -0,0 +1,154 @@
import json
from Src.Utilities.info import get_info_tmdb,is_movie
from Src.Utilities.convert import get_TMDb_id_from_IMDb_id
from Src.Utilities.loadenv import load_env
env_vars = load_env()
ForwardProxy = env_vars.get('ALTERNATIVE_LINK')
MYSTERIUS_KEY = env_vars.get('MYSTERIUS_KEY')
async def get_links(slug,season,episode,ismovie,client):
try:
headers = {
"x-api-key": MYSTERIUS_KEY
}
response = await client.get("https://aimammam-ulala12431.hf.space/api/cookie", headers=headers)
Auths = response.json()
Bearer = Auths.get('cookie')
ap_session = Auths.get('auth')
cookies = {'ap_session': ap_session}
print(cookies)
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
'authorization': f'Bearer {Bearer}',
'referer': f'https://altadefinizioneapp.com/play/{slug}',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 OPR/111.0.0.0',
'x-requested-with': 'XMLHttpRequest',
}
if ismovie == 1:
response = await client.get(f'https://altadefinizioneapp.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers)
elif ismovie == 0:
request_url =f'https://altadefinizioneapp.com/api/post/urls/stream/{slug}/{season}/{episode}'
print(request_url)
response = await client.get(request_url,cookies=cookies,headers=headers)
try:
video_data = response.json() # Assuming this is the JSON response containing video streams
if 'streams' not in video_data:
print("Invalid JSON format: 'streams' key not found or incorrect structure")
return None
streams = video_data['streams']
resolutions = {}
for stream in streams:
resolution_name = stream['resolution']['name'].lower() # Convert resolution name to lowercase
url = stream['url']
# Remove everything after '.mp4' in the URL
mp4_index = url.find('.mp4')
if mp4_index != -1:
url = url[:mp4_index + 4] # +4 to include '.mp4' in the substring
resolutions[resolution_name] = url
return resolutions
except KeyError as e:
print(f"KeyError: {e}")
return None
except json.JSONDecodeError as e:
print(f"JSONDecodeError: {e}")
return None
except Exception as e:
print(f"Request error: {e}")
return None
# Example usage: Fetch video links
# Print the dictionary
async def search_imdb(showname,tmdba,client):
showname = showname.replace(" ","%20")
tmdba = str(tmdba)
query = f'https://altadefinizioneapp.com/api/search?search={showname}&page=1'
response = await client.get(query,allow_redirects=True, impersonate = "chrome120")
if response.status_code == 200:
data = response.json()
if 'data' in data:
for item in data['data']:
tmdb_id = item.get('tmdb_id')
tmdb_id = ''.join(char for char in tmdb_id if char.isdigit())
if tmdb_id == tmdba:
slug = item.get('slug')
return slug
def parse_links(resolution_links):
results = {}
if resolution_links:
for resolution, link in resolution_links.items():
if "cdn.altadefinizione-originale.com" in link or "cdn.altadefinizioneapp.com" in link:
link = link.replace("cdn.altadefinizione-originale.com","protectlinknt.b-cdn.net").replace("cdn.altadefinizioneapp.com","protectlinknt.b-cdn.net")
results[resolution] = link
return results
else:
print("Failed to fetch video links")
async def cool(imdb,client):
try:
type = "Cool"
general = await is_movie(imdb)
ismovie = general[0]
imdb_id = general[1]
if ismovie == 0 :
season = int(general[2])
episode = int(general[3])
if "tt" in imdb:
#Get showname
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else:
tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type)
slug = await search_imdb(showname,tmdba,client)
if ismovie == 1:
season = None
episode = None
resolution_links = await get_links(slug,episode,season,ismovie,client)
results = parse_links(resolution_links)
return results
elif ismovie == 0:
season = season -1
episode = episode - 1
resolution_links = await get_links(slug,season,episode,ismovie,client)
results = parse_links(resolution_links)
return results
except Exception as e:
print("Cool Error",e)
return None
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 = "tt1839578:1:1" # This is an example ID format
results = await cool(test_id, client)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
+159
View File
@@ -0,0 +1,159 @@
import requests
import re
from bs4 import BeautifulSoup, SoupStrainer
from Src.Utilities.info import get_info_imdb, is_movie, get_info_tmdb
import urllib.parse
import Src.Utilities.config as config
DDL_DOMAIN = config.DDL_DOMAIN
ips4_device_key = config.ips4_device_key
ips4_login_key = config.ips4_login_key
ips4_member_id = config.ips4_member_id
ips4_IPSSessionFront = config.ips4_IPSSessionFront
cookies = {
'ips4_device_key': ips4_device_key,
'ips4_IPSSessionFront': ips4_IPSSessionFront,
'ips4_member_id': ips4_member_id,
'ips4_login_key': ips4_login_key
}
async def search_series(client,id,season,episode,showname):
showname = showname.replace(" ", "%20").replace("–", "+").replace("—","+")
response = await client.get(f"{DDL_DOMAIN}/search/?&q={showname}%20{season}%20Streaming&type=videobox_video&quick=1&nodes=11,36&search_and_or=and&search_in=titles&sortby=relevancy", cookies = cookies)
soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('a'))
a_tags = soup.find_all('a', {'data-linktype': 'link'})
for a in a_tags:
href = a['href']
response = await client.get(href, cookies = cookies)
soup = BeautifulSoup(response.text, 'lxml')
movie_ids = soup.find_all('a',{'rel':'external nofollow'})
for database in movie_ids:
link = database['href']
real_id = link.split('/')[4]
if real_id == id:
meta_description = soup.find('meta',{'name':'description'})
content = meta_description['content']
if f"Stagione {season}" in content:
return href
else:
continue
else:
continue
async def get_episode(client,link,episode):
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Referer': link,
'DNT': '1',
'Sec-GPC': '1',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
'Connection': 'keep-alive',
'Priority': 'u=1',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
params = {
'area': 'online',
}
response = await client.get(link, cookies = cookies, headers = headers, params = params, impersonate="chrome124")
pattern = rf'<a\s+href="([^"]+)"[^>]*>\s*Part {episode}\s*</a>'
match = re.search(pattern, response.text)
mp4_link = match.group(1)
mp4_link = mp4_link.replace("&amp","")
mp4_link = mp4_link.replace(";","&")
return mp4_link
async def search_movie(client,showname,id):
showname = showname.replace("–", "+").replace("—","+")
showname = urllib.parse.quote(showname)
link = f"{DDL_DOMAIN}/search/?&q={showname}%20Streaming&quick=1&nodes=11&search_and_or=and&search_in=titles&sortby=relevancy"
response = await client.get(link,impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('a'))
a_tags = soup.find_all('a', {'data-linktype': 'link'})
for a in a_tags:
href = a['href']
response = requests.get(href, cookies = cookies)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('a'))
movie_ids = soup.find_all('a',{'rel':'external nofollow'})
for database in movie_ids:
link = database['href']
real_id = link.split('/')[4]
if real_id == id:
return href
else:
continue
return
async def get_mp4(client,link):
response = await client.get(link, cookies = cookies)
soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('source'))
source_tag = soup.find('source')
final_url = source_tag['src']
res = source_tag.get('res')
return final_url,res
async def ddlstream(imdb,client):
try:
general = await is_movie(imdb)
ismovie = general[0]
id = general[1]
type = "DDLStream"
if "tt" in imdb:
showname = await get_info_imdb(id,ismovie,type,client)
else:
showname = get_info_tmdb(id,ismovie,type)
if ismovie == 0:
season = general[2]
episode = general[3]
page_link = await search_series(client,id,season,episode,showname)
mp4_link = await get_episode(client,page_link,episode)
final_url = await get_mp4(client,mp4_link)
return final_url
else:
page_link = await search_movie(client,showname,id)
mp4_link = page_link + "?area=online"
final_url = await get_mp4(client,mp4_link)
return final_url
except Exception as e:
print(f"MammaMia: DDLStream Failed {e}")
return None
async def test_animeworld():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
test_id = "tt3148266:3:4" # This is an example ID format
results = await ddlstream(test_id, client)
print(results)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
#python3 -m Src.API.ddlstream
+211
View File
@@ -0,0 +1,211 @@
from tmdbv3api import TMDb, Movie, TV
from bs4 import BeautifulSoup,SoupStrainer
import string
import re
import dateparser
from Src.Utilities.convert import get_TMDb_id_from_IMDb_id, get_IMDB_id_from_TMDb_id
from Src.Utilities.info import get_info_tmdb, is_movie, get_info_imdb
from Src.Utilities.convert_date import convert_US_date
import Src.Utilities.config as config
FT_DOMAIN = config.FT_DOMAIN
import urllib.parse
#Some basic headers
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
'Accept-Language': 'en-US,en;q=0.5'
}
#Map months to check if date = date
month_mapping = {
'Jan': 'Gennaio', 'Feb': 'Febbraio', 'Mar': 'Marzo', 'Apr': 'Aprile',
'May': 'Maggio', 'Jun': 'Giugno', 'Jul': 'Luglio', 'Aug': 'Agosto',
'Sep': 'Settembre', 'Oct': 'Ottobre', 'Nov': 'Novembre', 'Dec': 'Dicembre'
}
async def get_streamtape(link,client):
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
}
response = await client.get(link, headers=headers, impersonate = "chrome124")
regex = r"id=.*?(?=')"
matches = re.findall(regex, response.text)
i = 0
final_url = next((f"https://streamtape.com/get_video?{matches[i + 1]}" for i in range(len(matches) - 1) if matches[i] == matches[i + 1]), None)
return final_url
async def search(query,imdb_id,client,season,ismovie):
response = await client.get(query)
response = response.json()
#Get link tid of every item and then open the link to see if the date = date
for json in response:
link = json['link']
tid = json['id']
series_response = await client.get(link, headers=headers, allow_redirects=True, timeout = 30)
series_soup = BeautifulSoup(series_response.text, 'lxml')
imdb_pattern = r"'imdb_id':\s*'([^']+)'"
imdb_match = re.search(imdb_pattern, series_response.text)
if imdb_match:
id = imdb_match.group(1)
print(id)
if id == imdb_id:
url = link
tid = tid
if ismovie == 0:
Seasons = series_soup.find_all('span', class_="season-name")
i = 0
for item in Seasons:
season_text = item.text.strip()
if season in season_text and "SUB" not in season_text:
actual_season = i
return url, tid, actual_season
else:
i = i + 1
continue
else:
actual_season = None
return url, tid, actual_season
else:
print("There's no IMDB_ID")
def get_episode_link(actual_season,episode,tid,url):
#Get the link from where we have to obtain mixdrop link
tlink = f'{url}?show_video=true&post_id={tid}&season_id={actual_season}&episode_id={episode-1}'
return tlink
def get_film(url):
#Get the link from where we have to obtain mixdrop link
tlink = url + "?show_video=true"
return tlink
async def get_real_link(tlink,client):
try:
print(tlink)
#Some basic code to get the mixdrop link
page = await client.get(tlink, headers=headers, allow_redirects=True)
soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe'))
iframe_src = soup.find('iframe')['src']
iframe_page = await client.get(iframe_src, headers=headers, allow_redirects=True, timeout = 30)
iframe_soup = BeautifulSoup(iframe_page.content, features="lxml", parse_only=SoupStrainer('div',class_="megaButton"))
mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP')
if mega_button:
real_link = mega_button.get('meta-link')
return real_link
else:
mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='STREAMTAPE')
real_link = mega_button.get('meta-link')
return real_link
except Exception as e:
print(f"Error: {e}")
return None
async def get_true_link(real_link,client):
response = await client.get(real_link, headers=headers, allow_redirects=True,timeout = 30)
[s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2)
schema = s1.split(";")[2][5:-1]
terms = s2.split("|")
charset = string.digits + string.ascii_letters
d = dict()
for i in range(len(terms)):
d[charset[i]] = terms[i] or charset[i]
s = 'https:'
for c in schema:
s += d[c] if c in d else c
return s
async def filmpertutti(imdb,client,MFP):
try:
general = await is_movie(imdb)
ismovie = general[0]
imdb_id = general[1]
type = "Filmpertutti"
if ismovie == 0 :
season = general[2]
episode = int(general[3])
else:
season = None
episode = None
if "tt" in imdb:
showname = await get_info_imdb(imdb_id,ismovie,type,client)
elif "tmdb" in imdb:
#Get showname and date
tmdba = imdb_id.replace("tmdb:","")
imdb_id = await get_IMDB_id_from_TMDb_id(tmdba,client)
showname = get_info_tmdb(tmdba,ismovie,type)
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
showname = urllib.parse.quote_plus(showname)
# Build the query
query = f'{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
try:
url,tid,actual_season = await search(query,imdb_id,client,season,ismovie)
except:
print("MammaMia: No results found for Filmpertutti")
return None,None
if ismovie == 0:
episode_link = get_episode_link(actual_season,episode,tid,url)
#Let's get mixdrop link
real_link = await get_real_link(episode_link,client)
if MFP == "1":
if "mixdrop" in real_link:
Host = "Mixdrop"
elif "streamtape" in real_link:
Host = "Streamtape"
return real_link, Host
#let's get delivery link, streaming link
if "mixdrop" in real_link:
streaming_link = await get_true_link(real_link,client)
elif "streamtape" in real_link:
streaming_link = await get_streamtape(real_link,client)
Host = None
return streaming_link, Host
elif ismovie == 1:
film_link = get_film(url)
#Let's get mixdrop link
real_link = await get_real_link(film_link,client)
if MFP == "1":
if "mixdrop" in real_link:
Host = "Mixdrop"
elif "streamtape" in real_link:
Host = "Streamtape"
return real_link, Host
if "mixdrop" in real_link:
streaming_link = await get_true_link(real_link,client)
elif "streamtape" in real_link:
streaming_link = await get_streamtape(real_link,client)
#let's get delivery link, streaming link
Host = None
return streaming_link, Host
except Exception as e:
print(f"Filmpertutti failed: {e}")
return None,None
async def test_animeworld():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
MFP = "1"
# Replace with actual id, for example 'anime_id:episode' format
test_id = "tt1190634:1:1" # This is an example ID format
results = await filmpertutti(test_id, client,MFP)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
'''
series_response = await client.get(link, headers=headers, follow_redirects=True)
series_soup = BeautifulSoup(series_response.text, 'lxml')
release_span = series_soup.find('span', class_='released')
if release_span:
if release_span.text != "Data di uscita: N/A":
date_string = release_span.text.split(': ')[-1] # Get the date part
for eng, ita in month_mapping.items():
date_string = re.sub(rf'\b{eng}\b', ita, date_string)
# Swap to YY-MM-DD formatting using dateparser
release_date = dateparser.parse(date_string, languages=['it']).strftime("%Y-%m-%d")
'''
+110
View File
@@ -0,0 +1,110 @@
from tmdbv3api import TMDb, Movie, TV
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
import re
import json
LC_DOMAIN = config.LC_DOMAIN
async def search(showname,date,season,episode,ismovie,client):
cookies = {
'csrftoken': '7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ',
}
headers = {
'authority': f'{LC_DOMAIN}',
'accept': '*/*',
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
# 'cookie': 'csrftoken=7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ',
'referer': f'{LC_DOMAIN}/anime/anime-ita/',
'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Android"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
}
params = {
'media': showname,
'_': '1724421723999',
}
response = await client.get(f'{LC_DOMAIN}/live_search/', params=params, cookies=cookies, headers=headers, allow_redirects=True, impersonate = "chrome124")
data = json.loads(response.text)
for entry in data['data']:
if entry is not None: # check if the a_tag exists
href = entry['url']
quality = entry['qualit\u00e0_video']
link = f'{LC_DOMAIN}{href}'
response = await client.get(link, allow_redirects=True, impersonate = "chrome120")
soup2 = BeautifulSoup(response.text,'lxml')
li_tag = soup2.select_one("ul.card__meta li:nth-of-type(2)")
if li_tag is not None: # check if the li_tag exists
card_date = li_tag.text[-4:]
if card_date == date:
if ismovie == 1:
video_url = soup2.find('a', class_="btn-streaming streaming_btn")
video_url = video_url['href']
return video_url,quality
elif ismovie == 0:
div = soup2.find('div', id=f'collapse{season}')
#Index start from 0 so I need to subtract 1
episode_find = div.select('tr')[episode]
# index is 2 because we want the correct element
video_url = episode_find.find('a').get('href')
return video_url,quality
else:
print("")
continue
async def get_m3u8(video_url,client):
response = await client.get(video_url, allow_redirects=True, impersonate = "chrome120")
pattern = r'https?://[^\s]+\.m3u8'
match = re.search(pattern, response.text)
if match:
url = match.group(0)
return url
async def lordchannel(imdb,client):
try:
general = await is_movie(imdb)
ismovie = general[0]
imdb_id = general[1]
type = "LordChannel"
if ismovie == 0:
season = int(general[2])
episode = int(general[3])
if "tt" in imdb:
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else:
tmdba = imdb_id
else:
season = None
episode = None
if "tt" in imdb:
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else:
tmdba = imdb_id
showname,date = get_info_tmdb(tmdba,ismovie,type)
video_url,quality = await search(showname,date,season,episode,ismovie,client)
url = await get_m3u8(video_url,client)
url = url.replace('"','')
print("MammaMia: Found results for LordChannel")
return url,quality
except Exception as e:
print("MammaMia: Lordchannel Failed",e)
return None,None
async def test_animeworld():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
results = await lordchannel("tt0920489:3:2",client)
print(results)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
#python3 -m Src.API.lordchannel
+132
View File
@@ -0,0 +1,132 @@
from urllib.parse import urlparse, parse_qs,unquote,quote
from fastapi import APIRouter, HTTPException, Response, Request
from curl_cffi.requests import AsyncSession
import Src.Utilities.config as config
from Src.Utilities.loadenv import load_env
env_vars = load_env()
SC_PROXY = config.SC_PROXY
VX_PROXY = config.VX_PROXY
import json
import re
import random
proxies = {}
proxies2 = {}
if VX_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies2 = {}
else:
proxies2 = {
"http": proxy,
"https": proxy
}
if SC_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies = {}
else:
proxies = {
"http": proxy,
"https": proxy
}
if VX_PROXY == "1":
proxies2 = proxies
SC_ForwardProxy = config.SC_ForwardProxy
VX_ForwardProxy = config.VX_ForwardProxy
if SC_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
if VX_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
router = APIRouter()
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
async def fetch_m3u8(url):
"""Fetch the M3U8 file from the URL and store it in memory."""
async with AsyncSession() as client:
response = await client.get(ForwardProxy + url,headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
response.raise_for_status() # Raise an error for bad responses
return response.text
@router.get("/clone/manifest.m3u8")
async def clone_m3u8(d: str = None):
if d:
try:
d = unquote(d)
m3u8_content = await fetch_m3u8(d)
return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
except Exception as e:
print(f"Failed to fetch M3U8 file: {e}")
raise HTTPException(status_code=404, detail="M3U8 content not found")
#This is just for testing, ignore that endpoint and the func
@router.api_route("/vixcloud/manifest.m3u8", methods=["GET", "HEAD"])
async def clone2_m3u8(d:str,token:str,expires:str,h:str = None, b:str = None, request: Request = None):
try:
m3u8 = f'{d}?token={token}&expires={expires}'
if h:
m3u8 = m3u8 + f'&h={h}'
if b:
m3u8 = m3u8 + f'&b={b}'
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}"
m3u8_content = await fetch_m3u8(m3u8)
modified_playlist = m3u8_content.replace("https://vixcloud.co/playlist/", f"{instance_url}/clony/")
return Response(content=modified_playlist, media_type='application/vnd.apple.mpegurl')
except Exception as e:
print(f"Failed to fetch M3U8 file: {e}")
raise HTTPException(status_code=404, detail="M3U8 content not found")
@router.api_route("/clony/{segment:path}", methods=["GET", "HEAD"])
async def clony_m3u8(segment: str, request: Request):
base_url = "https://vixcloud.co/playlist/"
full_url = f"{base_url}{segment}?{request.query_params}"
print(full_url, "A",request.query_params)
if "rendition=1080p" in full_url or "type=subtitle" in full_url:
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)
return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
@router.api_route('/storage/enc.key')
async def get_key():
async with AsyncSession(timeout = 20) as client:
response = await client.get(ForwardProxy + 'https://vixcloud.co/storage/enc.key', headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
response_headers = {
'date': response.headers['date'],
'content-length': response.headers['content-length'],
'content-type': 'application/octet-stream',
'access-control-allow-origin': '*'
}
return Response(
response.content,
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)
'''
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
'''
+38
View File
@@ -0,0 +1,38 @@
from bs4 import BeautifulSoup
import json
from Src.Utilities.dictionaries import okru
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'DNT': '1',
'Sec-GPC': '1',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Priority': 'u=1',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
async def okru_get_url(id,client):
try:
embed_link = okru[id]
response = await client.get(embed_link, allow_redirects=True, headers = headers, impersonate = "chrome124")
soup = BeautifulSoup(response.text, 'lxml')
div = soup.find('div', {'data-module': 'OKVideo'})
data_options = div.get('data-options')
data = json.loads(data_options)
metadata = json.loads(data['flashvars']['metadata'])
m3u8_link = metadata['hlsMasterPlaylistUrl']
print("MammaMia: Found results for Okru")
return m3u8_link
except Exception as e:
print("MammaMia: No results found for Okru")
return None
+157
View File
@@ -0,0 +1,157 @@
from Src.Utilities.info import get_info_imdb, is_movie, get_info_tmdb
from bs4 import BeautifulSoup,SoupStrainer
import Src.Utilities.config as config
from fake_headers import Headers
from Src.Utilities.loadenv import load_env
import json, random
import re
from Src.Utilities.eval import eval_solver
import urllib.parse
OST_DOMAIN = config.OST_DOMAIN
OST_PROXY = config.OST_PROXY
env_vars = load_env()
proxies = {}
if OST_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies = {}
else:
proxies = {
"http": proxy,
"https": proxy
}
OST_ForwardProxy = config.OST_ForwardProxy
if OST_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.71 Mobile Safari/537.36',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'X-Requested-With': 'XMLHttpRequest',
'DNT': '1',
'Sec-GPC': '1',
'Connection': 'keep-alive',
'Referer': f'https://onlineserietv.{OST_DOMAIN}/',
# 'Cookie': 'player_opt=fx',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
async def search(showname,date,client,ismovie,episode,season):
cookies = {
'player_opt': 'fx',
}
params = {
's': showname,
'action': 'searchwp_live_search',
'swpengine': 'default',
'swpquery': showname,
'origin_id': '50141',
'searchwp_live_search_client_nonce': 'undefined',
}
response = await client.get(ForwardProxy + f"https://onlineserietv.{OST_DOMAIN}/wp-admin/admin-ajax.php?s={urllib.parse.quote(showname)}&action=searchwp_live_search&swpengine=default&swpquery={urllib.parse.quote(showname)}&origin_id=50141&searchwp_live_search_client_nonce=undefined", headers=headers, cookies=cookies, impersonate = "chrome124", proxies = proxies)
if response.status_code != 200:
print("IP Blocked by OnlineserieTV",response)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('a'))
a_tags_with_href = soup.find_all("a", href=True)
for a_tag in a_tags_with_href:
href = a_tag.get("href")
if ismovie == 1:
if "film" in href:
response = await client.get(ForwardProxy + href, headers=headers, impersonate = "chrome124", proxies = proxies)
if response.status_code != 200:
print("IP Blocked by OnlineserieTV",response)
year_match = re.search(r'Anno: <i>(\d{4})</i>', response.text)
year = year_match.group(1) if year_match else None
if year == date:
pattern = r'https://uprot\.net/fxf/[^\s"<>]+'
match = re.search(pattern, response.text)
if match:
name = a_tag.text.replace("\t","").replace("\n","")
flexy_link = match.group()
return flexy_link,name
else:
print("No flexy link found.")
else:
continue
elif ismovie == 0:
if "serietv" in href:
response = await client.get(ForwardProxy + href, headers=headers, impersonate = "chrome124", proxies = proxies)
if response.status_code != 200:
print("IP Blocked by OnlineserieTV",response)
year_match = re.search(r'Anno: <i>(\d{4})</i>', response.text)
year = year_match.group(1) if year_match else None
if year == date:
season = season.zfill(2)
episode = episode.zfill(2)
if season == "0000000000000":
print(True,season,episode)
#pattern = rf'{season}x{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)|0{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
pattern = rf'0{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
match1 = re.findall(pattern, response.text)
match = re.search(pattern, response.text)
print(match)
else:
pattern = rf'{season}x{episode}.*?<a href=[\'"](https://uprot\.net/fxf/[^\'"]+)'
match = re.search(pattern, response.text, re.DOTALL)
if match:
name = a_tag.text.replace("\t","").replace("\n","")
flexy_link = match.group(1)
print(match,flexy_link)
return flexy_link,name
else:
print("No flexy link found.")
else:
continue
async def onlineserietv(id,client):
try:
general = await is_movie(id)
ismovie = general[0]
clean_id = general[1]
if ismovie == 0:
season = general[2]
episode = general[3]
elif ismovie == 1:
season = None
episode = None
type = "Onlineserietv"
if "tt" in id:
showname,date = await get_info_imdb(clean_id,ismovie,type,client)
else:
showname,date = get_info_tmdb(clean_id,ismovie,type)
showname = showname.replace("'"," ")
flexy_link,name = await search(showname,date,client,ismovie,episode,season)
flexy_link = flexy_link.replace("fxf","fxe")
real_url = await client.head(ForwardProxy + flexy_link, headers=headers, impersonate = "chrome124", proxies = proxies)
real_url = real_url.url
final_url = await eval_solver(real_url,proxies, ForwardProxy, client)
return final_url,name
except Exception as e:
print("MammaMia: Onlineserietv Failed",e)
return None,None
async def test_animeworld():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
test_id = "tt0206516:2:1" # This is an example ID format
results = await onlineserietv(test_id, client)
print(results)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
# Guru Guru tt0330592 Uomo tigre tt0206516
#python3 -m Src.API.onlineserietv
+301
View File
@@ -0,0 +1,301 @@
from bs4 import BeautifulSoup,SoupStrainer
import re
import time
from Src.Utilities.info import is_movie,get_info_imdb,get_info_tmdb
import Src.Utilities.config as config
from Src.Utilities.loadenv import load_env
env_vars = load_env()
TF_PROXY = config.TF_PROXY
if TF_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
TF_FORWARDPROXY = config.TF_ForwardProxy
if TF_FORWARDPROXY == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
TF_DOMAIN = config.TF_DOMAIN
import urllib.parse
async def search(showname,ismovie,date,client):
showname = showname.replace(" ","+")
url = f'{TF_DOMAIN}/ajax/posts?q={showname}'
response = await client.get(url, allow_redirects=True)
response = response.json()['data']
if ismovie == 1:
for link in response:
url = link['url']
response = await client.get(url, allow_redirects=True, impersonate = "chrome120")
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
found_date = re.search(pattern, response.text)
release_date = str(found_date.group(1))
if release_date == date:
tid= url.split('-')[-1]
#Return URL and even the soup so I can use it later
#I try to get doodstream link inside this function so I do not have to get again the response
return tid,url
elif ismovie == 0:
for link in response:
base_url = link['url']
url = f'{base_url}-1-season-1-episode'
response = await client.get(url, allow_redirects=True, impersonate = "chrome120")
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
found_date = re.search(pattern, response.text)
release_date = str(found_date.group(1))
if release_date == date:
tid= url.split('-')[1]
soup = BeautifulSoup(response.text, 'lxml')
a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
embed_id = a_tag['data-embed']
#I try to get doodstream link inside this function so I do not have to get again the response
return url,embed_id
async def fast_search(showname,ismovie,client):
showname = showname.replace(" ","%20")
url = f'{TF_DOMAIN}/search/{showname}'
response = await client.get(url, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, "lxml")
if ismovie == 1:
first_link = soup.select_one('#movies .col .list-media')
url = first_link['href']
tid= url.split('-')[1]
return tid,url
elif ismovie == 0:
first_link = soup.select_one('#series .col .list-media')
base_url = first_link['href']
url = f'{base_url}-1-season-1-episode'
response = await client.get(url, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml')
a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
embed_id = a_tag['data-embed']
return url,embed_id
async def get_protect_link(id,url,client):
#Get the link where the Iframe is located, which contains the doodstream url kind of.
response = await client.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}", allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src']
if "protect" in protect_link:
return protect_link
else:
#DO this in case the movie has a 3D version etc
response = await client.get(url, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml')
a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
embed_id = a_tag['data-embed']
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
'Referer': url
}
#Parameters needed is the embed ID
data = {
'id': embed_id
}
ajax_url = f"{TF_DOMAIN}/ajax/embed"
response = await client.post(ajax_url, headers=headers, data=data)
hdplayer = response.text[43:-27]
response = await client.get(hdplayer, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml')
links_dict = {}
li_tags = soup.select('ul.nav.navbar-nav li.dropdown')
for li_tag in li_tags:
a_tag = li_tag.find('a')
if a_tag:
title = a_tag.text.strip()
#Since tantifilm player is broken I just skip it
if title == "1" or "Tantifilm" in title:
continue # Get the text of the <a> tag
href = a_tag['href']
response = await client.get(href, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src']
if "protect" in protect_link:
url = await true_url(protect_link,client)
links_dict[title] = url
return links_dict
# Get the value of the href attribute
async def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode,client):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
'Referer': url
}
#Parameters needed is the embed ID
data = {
'id': embed_id
}
ajax_url = f"{TF_DOMAIN}/ajax/embed"
response = await client.post(ajax_url, headers=headers, data=data)
nuovo_indirizzo = response.text[43:-27]
response = await client.get(nuovo_indirizzo, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml')
#Get season
season = season - 1
li_tags = soup.select('ul.nav.navbar-nav > li.dropdown')
if len(li_tags) != 1:
link = li_tags[season].find('a')['href']
response = await client.get(link, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, 'lxml')
option_tag = soup.select(f'select[name="ep_select"] > option:nth-of-type({episode})')[0]
link = option_tag['value']
#Let's find protect link now
response = await client.get(link, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src']
return protect_link
else:
#If there is only one season than
option_tag = soup.select('select.dynamic_select > option')[episode]
link = option_tag['value']
#Let's find protect link now
response = await client.get(link, allow_redirects=True, impersonate = "chrome120")
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src']
return protect_link
async def true_url(protect_link,client):
# Define headers
headers = {
"Range": "bytes=0-",
"Referer": "https://d000d.com/",
}
doodstream_url = protect_link
proxies = {}
if TF_PROXY == "1":
import random
import json
print(PROXY_CREDENTIALS)
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies = {}
else:
proxies = {
"http": proxy,
"https": proxy
}
elif TF_FORWARDPROXY == "1":
response = await client.head(protect_link, allow_redirects=True, impersonate = "chrome120", proxies = proxies)
doodstream_url = response.url
response = await client.get(ForwardProxy + doodstream_url, allow_redirects=True, impersonate = "chrome120", proxies = proxies)
if response.status_code == 200:
# Get unique timestamp for the request
real_time = str(int(time.time()))
# Regular Expression Pattern for the match
pattern = r"(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)"
# Find the match
match = re.search(pattern, response.text, re.DOTALL)
# If a match was found
if match:
# Create real link (match[0] includes all matched elements)
url =f'https://d000d.com{match[1]}'
rebobo = await client.get(ForwardProxy + url, headers=headers, allow_redirects=True, impersonate = "chrome120",proxies= proxies)
if len(rebobo.text)> 2:
real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
print("MammaMia: Found results for Tantifilm")
return real_url
else:
print("Tantifilm: No match found in the text. Please be sure you are using a local instance")
return None
print("Error: Could not get the response.")
return None
#Get temporaly ID
async def tantifilm(imdb,client,TF_FAST_SEARCH):
urls = None
try:
general = await is_movie(imdb)
ismovie = general[0]
imdb_id = general[1]
if ismovie == 0 :
season = int(general[2])
episode = int(general[3])
if "tt" in imdb:
if TF_FAST_SEARCH == "0":
type = "Tantifilm"
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
url,embed_id = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1":
type = "TantifilmFS"
showname = await get_info_imdb(imdb_id,ismovie,type,client)
url,embed_id = await fast_search(showname,ismovie,client)
else:
#else just equals them
tmdba = imdb_id.replace("tmdb:","")
if TF_FAST_SEARCH == "0":
type = "Tantifilm"
showname,date = get_info_tmdb(tmdba,ismovie,type)
url,embed_id = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1":
type = "TantifilmFS"
showname= get_info_tmdb(tmdba,ismovie,type)
url,embed_id = await fast_search(showname,ismovie,client)
protect_link = await get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode,client)
url = await true_url(protect_link,client)
return url
elif ismovie == 1:
if "tt" in imdb:
#Get showname
if TF_FAST_SEARCH == "0":
type = "Tantifilm"
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
tid,url = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1":
type = "TantifilmFS"
showname = await get_info_imdb(imdb_id,ismovie,type,client)
date = None
tid,url = await fast_search(showname,ismovie,client)
else:
if TF_FAST_SEARCH == "0":
type = "Tantifilm"
showname,date = get_info_tmdb(imdb,ismovie,type)
tid,url = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1":
type = "TantifilmFS"
showname = get_info_tmdb(imdb,ismovie,type)
tid,url = await fast_search(showname,ismovie,client)
protect_link = await get_protect_link(tid,url,client)
if not isinstance(protect_link, str):
urls = protect_link
if urls:
return urls
else:
print("Tantifilm Error v2")
else:
url = await true_url(protect_link,client)
if url:
return url
except Exception as e:
print("Tantifilm Error: ", e)
return None
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 = "tt3148266:1:1" # This is an example ID format
results = await tantifilm(test_id, client,"0")
print(results)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())
+186
View File
@@ -0,0 +1,186 @@
import random
from bs4 import BeautifulSoup,SoupStrainer
import Src.Utilities.config as config
from Src.Utilities.dictionaries import webru_vary,webru_dlhd,skystreaming
from Src.Utilities.loadenv import load_env
from urllib.parse import urlparse
import re
TF_DOMAIN = config.TF_DOMAIN
DLHD_DOMAIN = config.DLHD_DOMAIN
env_vars = load_env()
MEDIAFLOW_PASS = env_vars.get('MEDIAFLOW_PASS')
Referer = "https://ilovetoplay.xyz/"
Origin = "https://ilovetoplay.xyz"
key_url = "https%3A%2F%2Fkey2.keylocking.ru%2F"
headers = {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0",
"Accept": "*/*",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Origin": Origin,
"DNT": "1",
"Sec-GPC": "1",
"Connection": "keep-alive",
"Referer": Referer,
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "cross-site",
"Pragma": "no-cache",
"Cache-Control": "no-cache",
}
async def get_stream_link(id,site,client):
try:
if site == "dlhd":
dlhd_id = webru_dlhd[id]
response = await client.get(f"{DLHD_DOMAIN}/embed/stream-853.php", impersonate = "chrome124", headers = headers)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('iframe'))
iframe = soup.find('iframe', id='thatframe')
real_link = iframe.get('src')
parent_site_domain = real_link.split('/premiumtv')[0]
server_key_link = (f'{parent_site_domain}/server_lookup.php?channel_id={dlhd_id}')
response = await client.get(server_key_link, allow_redirects = False)
server_key = response.json()['server_key']
'''
response = await client.get(real_link, allow_redirects = False)
print(response.text)
pattern = r"source:\s*'([^']*\.m3u8)'"
match = re.search(pattern, response.text)
if match:
m3u8_url = match.group(1) # The URL is captured in the first capturing group
parsed_url = urlparse(m3u8_url)
domain = parsed_url.netloc
else:
print("No .m3u8 URL found.")
'''
stream_url = f"https://{server_key}new.iosplayer.ru/{server_key}/{dlhd_id}" + "/mono.m3u8"
return stream_url,Referer,Origin
elif site == "vary":
response = await client.get("https://calcio.monster/streaming-gratis-calcio-1.php", impersonate = "chrome124", headers = headers)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('div', class_='ticket_btn'))
href = soup.find('a').get('href')
response = await client.get(href)
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('button'))
webru_iframe = soup.find_all('button', {"data-type": "embed"})
for i in webru_iframe:
webru_iframe = i.get('data-url')
if "php" not in webru_iframe:
continue
else:
break
webru_iframe = "https://" + webru_iframe.split("/")[2]
vary_id = webru_vary[id]
vary_link = f"{webru_iframe}/server_lookup.php?channel_id={vary_id}"
response = await client.get(vary_link, headers=headers, allow_redirects=True, impersonate = "chrome124")
server_key = response.json()['server_key']
stream_url = f"https://{server_key}new.iosplayer.ru/{server_key}/{vary_id}" + "/mono.m3u8"
return stream_url,Referer,Origin
except Exception as e:
print("WebRu failed",e)
return None,None,None
async def webru(id,site,client):
try:
new_stream_url,Referer,Origin = await get_stream_link(id,site,client)
if new_stream_url == None:
raise Exception("No stream URL found")
return new_stream_url,Referer,Origin
except Exception as e:
print("WebRu failed",e)
return None,None,None
async def get_skystreaming(id,client):
try:
skystreaming_link = skystreaming[id]
if type(skystreaming_link) == list:
for link in skystreaming_link:
m3u8_url,Host,Origin = await get_skystreaming_url(link,client)
else:
m3u8_url,Host,Origin = await get_skystreaming_url(skystreaming_link,client)
return m3u8_url,Host,Origin
except Exception as e:
print("SkyStreaming failed",e)
return None,None,None
async def get_skystreaming_url(skystreaming_link,client):
try:
if "hls" in skystreaming_link:
m3u8_url = skystreaming_link
Host = m3u8_url.replace("https://","").split("/")[0]
response = await client.get(skystreaming_link, headers=headers, allow_redirects=True, impersonate = "chrome120")
Origin = response.url.split('/embed')[0]
return m3u8_url,Host,Origin
response = await client.get(skystreaming_link, headers=headers, allow_redirects=True, impersonate = "chrome120")
Origin = response.url.split('/embed')[0]
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('source'))
source_tag = soup.find('source')
m3u8_url = source_tag.get('src')
Host = m3u8_url.replace("https://","").split("/")[0]
return m3u8_url,Host,Origin
except Exception as e:
print("SkyStreaming failed",e)
return None,None
'''
async def webru(id,site,client,MFP_CREDENTIALS):
try:
stream_url, Referer,Origin = await get_stream_link(id,site,client)
mfp_url = MFP_CREDENTIALS[0]
mfp_pass = MFP_CREDENTIALS[1]
new_stream_url = f'{mfp_url}/proxy/hls/manifest.m3u8?api_password={mfp_pass}&d={stream_url}&h_Referer={Referer}&h_Origin={Origin}&h_User-Agent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F58.0.3029.110%20Safari%2F537.3'
return new_stream_url
except Exception as e:
print("WebRu failed",e)
return None
'''
'''
async def webru2(id,site,client):
try:
print(id)
if site == "vary":
print("1")
url = await get_stream_link(id,site)
if any(keyword in id for keyword in ["cinema", "arte", "nature", "investigation", "sky-uno", "sky-serie"]):
print("2")
url = await get_stream_link(id,site)
else:
print("3")
response = await client.get(f"https://848b3516657c-worldwide-sports-tv.baby-beamup.club/stream/tv/wwstv-it-{id}.json", impersonate = "chrome120", headers = headers)
data = response.json()
url = data['streams'][0]['url']
print(url)
return url
except Exception as e:
print("WorldSport failed",e)
return None
'''
'''
if id in skystreaming:
i = i+1
url,Host = await get_skystreaming(id,client)
streams['streams'].append({'title': f'{HF}Server {i}', 'url': url, "behaviorHints": {"notWebReady": True, "proxyHeaders": {"request": {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Origin": "https://skystreaming.guru", "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": "https://skystreaming.guru/", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "Pragma": "no-cache", "Cache-Control": "no-cache", "TE": "trailers","Host": Host}}}})
'''
async def test_webru():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
# Replace with actual id, for example 'anime_id:episode' format
test_id = "sky-sport-uno" # This is an example ID format
results = await get_skystreaming(test_id,client)
print(results)
if __name__ == "__main__":
import asyncio
asyncio.run(test_webru())
+126
View File
@@ -0,0 +1,126 @@
from Src.Utilities.info import is_movie,get_info_imdb,get_info_tmdb
import json
import urllib.parse
#This doesn't work anymore.
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Origin': 'https://www.vidbinge.com',
'DNT': '1',
'Sec-GPC': '1',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'Connection': 'keep-alive',
'Priority': 'u=4',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
# Requests doesn't support trailers
# 'TE': 'trailers',
}
async def whvx(id,client):
general = is_movie(id)
ismovie = general[0]
imdb_id = general[1]
type = "Whvx"
if ismovie == 0:
ismovie2 = "tv"
season = general[2]
episode = general[3]
elif ismovie == 1:
ismovie2 = "movie"
season = ""
episode = ""
if "tt" in id:
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
params = {
"query": {
"title": showname,
"releaseYear": date,
"imdbId": imdb_id,
"type": ismovie2,
"season": season,
"episode": episode
},
"provider": "nova"
}
elif "tmdb" in id:
showname,date = get_info_tmdb(id,ismovie,type)
params = {
"query": {
"title": showname,
"releaseYear": date,
"tmdbId": imdb_id,
"type": ismovie2,
"season": season,
"episode": episode
},
"provider": "nova"
}
showname = urllib.parse.quote_plus(showname)
response = await client.get(f'https://api.whvx.net/search', params = params, headers=headers, impersonate = "chrome120")
data = json.loads(response.text)
print(data)
url = data['url']
print(data)
params = {
'resourceId': url,
'provider': 'nova',
}
headers2 = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Origin': 'https://www.vidbinge.com',
'DNT': '1',
'Sec-GPC': '1',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'Connection': 'keep-alive',
'Priority': 'u=4',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
# Requests doesn't support trailers
# 'TE': 'trailers',
}
response = await client.get('https://api.whvx.net/source', params=params, headers=headers2, impersonate = "chrome120")
data = json.loads(response.text)
resolution_links = {}
for quality, details in data['stream'][0]['qualities'].items():
resolution_links[quality] = details['url']
print(resolution_links)
return resolution_links
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 = "tt6263850" # This is an example ID format
results = await whvx(test_id, client)
if __name__ == "__main__":
import asyncio
asyncio.run(test_animeworld())