1.1.0 Updated! Added Live TV!
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import datetime
|
||||
import json
|
||||
from Src.Utilities.info import get_info_kitsu
|
||||
import Src.Utilities.config as config
|
||||
import re
|
||||
AW_DOMAIN = config.AW_DOMAIN
|
||||
months = {
|
||||
"Gennaio": "January", "Febbraio": "February", "Marzo": "March",
|
||||
"Aprile": "April", "Maggio": "May", "Giugno": "June",
|
||||
"Luglio": "July", "Agosto": "August", "Settembre": "September",
|
||||
"Ottobre": "October", "Novembre": "November", "Dicembre": "December"
|
||||
}
|
||||
showname_replace = {
|
||||
"Attack on Titan": "L'attacco dei Giganti",
|
||||
"Season": "",
|
||||
" ": " ",
|
||||
"Shippuuden": "Shippuden",
|
||||
" ": "+",
|
||||
}
|
||||
|
||||
async def get_mp4(anime_url,ismovie,episode,client):
|
||||
response = await client.get(anime_url,allow_redirects=True, impersonate = "chrome120")
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
episode_page = soup.find('a', {'data-episode-num':episode })
|
||||
if episode_page is None:
|
||||
return None
|
||||
episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}'
|
||||
response = await client.get(episode_page,allow_redirects=True, impersonate = "chrome120")
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
||||
url = a_tag['href']
|
||||
response = await client.head(url)
|
||||
if response.status_code == 404:
|
||||
url = None
|
||||
return url
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async def old_search(showname,date,ismovie,episode,client):
|
||||
cookies = {
|
||||
'sessionId': 's%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ',
|
||||
}
|
||||
|
||||
headers = {
|
||||
'authority': f'www.animeworld.{AW_DOMAIN}',
|
||||
'accept': 'application/json, text/javascript, */*; q=0.01',
|
||||
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
# 'content-length': '0',
|
||||
# 'cookie': 'sessionId=s%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ',
|
||||
'csrf-token': 'oKFK43s4-BzfqPX27RlAORUd-iyiAfXyfDAo',
|
||||
'origin': f'https://www.animeworld.{AW_DOMAIN}',
|
||||
'referer': f'https://www.animeworld.{AW_DOMAIN}/',
|
||||
'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 = {
|
||||
'keyword': showname,
|
||||
}
|
||||
|
||||
response = await client.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers,allow_redirects=True, impersonate = "chrome120")
|
||||
|
||||
data = json.loads(response.text)
|
||||
final_urls = []
|
||||
for anime in data["animes"]:
|
||||
release_date = anime["release"]
|
||||
for ita, eng in months.items():
|
||||
release_date = release_date.replace(ita, eng)
|
||||
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
||||
release_date = release_date.strftime("%Y-%m-%d")
|
||||
if release_date == date:
|
||||
identifier = anime["identifier"]
|
||||
link = anime["link"]
|
||||
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
|
||||
final_url = await get_mp4(anime_url,ismovie,episode,client)
|
||||
final_urls.append(final_url)
|
||||
break
|
||||
showname = showname + " (ITA)"
|
||||
params = {
|
||||
'keyword': showname,
|
||||
}
|
||||
response = await client.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers, allow_redirects=True, impersonate = "chrome120")
|
||||
data = json.loads(response.text)
|
||||
for anime in data["animes"]:
|
||||
release_date = anime["release"]
|
||||
for ita, eng in months.items():
|
||||
release_date = release_date.replace(ita, eng)
|
||||
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
||||
release_date = release_date.strftime("%Y-%m-%d")
|
||||
if release_date == date:
|
||||
identifier = anime["identifier"]
|
||||
link = anime["link"]
|
||||
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
|
||||
final_url = await get_mp4(anime_url,ismovie,episode,client)
|
||||
final_urls.append(final_url)
|
||||
break
|
||||
return final_urls
|
||||
|
||||
async def search(showname,date,ismovie,episode,client):
|
||||
search_year = date[:4]
|
||||
response = await client.get(f'https://www.animeworld.so/filter?year={search_year}&sort=2&keyword={showname}',allow_redirects=True, impersonate = "chrome120")
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
anime_list = soup.find_all('a', class_=['poster', 'tooltipstered'])
|
||||
final_urls = []
|
||||
for anime in anime_list:
|
||||
anime_info_url = f'https://www.animeworld.{AW_DOMAIN}/{anime["data-tip"]}'
|
||||
response = await client.get(anime_info_url,allow_redirects=True, impersonate = "chrome120")
|
||||
pattern = r'<label>Data di uscita:</label>\s*<span>\s*(.*?)\s*</span>'
|
||||
match = re.search(pattern, response.text, re.S)
|
||||
release_date = match.group(1).strip()
|
||||
for ita, eng in months.items():
|
||||
release_date = release_date.replace(ita, eng)
|
||||
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
||||
release_date = release_date.strftime("%Y-%m-%d")
|
||||
if release_date == date:
|
||||
anime_url = f'https://www.animeworld.{AW_DOMAIN}{anime["href"]}'
|
||||
final_url = await get_mp4(anime_url,ismovie,episode,client)
|
||||
if final_url:
|
||||
final_urls.append(final_url)
|
||||
|
||||
return final_urls
|
||||
|
||||
async def animeworld(id,client):
|
||||
try:
|
||||
print(id)
|
||||
kitsu_id = id.split(":")[1]
|
||||
episode = id.split(":")[2]
|
||||
ismovie = 1 if len(id.split(":")) == 2 else 0
|
||||
showname,date = await get_info_kitsu(kitsu_id,client)
|
||||
for key in showname_replace:
|
||||
if key in showname: # Check if the key is a substring of showname
|
||||
showname = showname.replace(key, showname_replace[key])
|
||||
if "Naruto:" in showname:
|
||||
showname = showname.replace(":", "")
|
||||
final_urls = await search(showname,date,ismovie,episode,client)
|
||||
return final_urls
|
||||
except:
|
||||
print("Animeworld failed")
|
||||
return None
|
||||
|
||||
#async def test_animeworld():
|
||||
async with httpx.AsyncClient() as client:
|
||||
# Replace with actual id, for example 'anime_id:episode' format
|
||||
test_id = "kitsu:1555:1" # This is an example ID format
|
||||
results = await animeworld(test_id, client)
|
||||
print(results)
|
||||
|
||||
#if __name__ == "__main__":
|
||||
import httpx
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
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()
|
||||
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://mammamia-urlo-ulala12431.hf.space/api/cookie", headers=headers)
|
||||
Auths = response.json()
|
||||
Bearer = Auths.get('cookie')
|
||||
ap_session = Auths.get('auth')
|
||||
|
||||
cookies = {'ap_session': ap_session}
|
||||
|
||||
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://altadefinizione-originale.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://altadefinizione-originale.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers)
|
||||
elif ismovie == 0:
|
||||
print("HERE SEASON",season)
|
||||
print("HERE EPISODE",episode)
|
||||
request_url =f'https://altadefinizione-originale.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 client.RequestException as e:
|
||||
print(f"Request error: {e}")
|
||||
return None
|
||||
|
||||
|
||||
# Example usage: Fetch video links
|
||||
|
||||
|
||||
# Print the dictionary
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async def search_imdb(showname,tmdba,client):
|
||||
tmdba = str(tmdba)
|
||||
query = f'https://altadefinizione-originale.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')
|
||||
print(slug)
|
||||
return slug
|
||||
|
||||
|
||||
|
||||
def parse_links(resolution_links):
|
||||
results = {}
|
||||
if resolution_links:
|
||||
print("Video links:")
|
||||
for resolution, link in resolution_links.items():
|
||||
if "cdn.altadefinizione-originale.com" in link:
|
||||
link = link.replace("cdn.altadefinizione-originale.com","protectlinknt.b-cdn.net")
|
||||
print(f"{resolution}: {link}")
|
||||
results[resolution] = link
|
||||
return results
|
||||
else:
|
||||
print("Failed to fetch video links")
|
||||
|
||||
|
||||
async def cool(imdb,client):
|
||||
try:
|
||||
type = "Cool"
|
||||
general = 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)
|
||||
print(ismovie)
|
||||
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 = get_links(slug,season,episode,ismovie)
|
||||
results = parse_links(resolution_links)
|
||||
return results
|
||||
except Exception as e:
|
||||
print("Cool Error",e)
|
||||
return None
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import httpx
|
||||
|
||||
tivu = {
|
||||
"dazn-zona-a": "801",
|
||||
}
|
||||
"""
|
||||
"rai-1": "3401",
|
||||
"rai-2": "3402",
|
||||
"rai-3": "3403",
|
||||
"rete-4": "123",
|
||||
"canale-5": "122",
|
||||
"italia-1": "121",
|
||||
"la7": "79",
|
||||
"tv8": "7260",
|
||||
"nove": "4323",
|
||||
"rai-4": "3405",
|
||||
"rai-movie": "3406",
|
||||
"rai-premium": "8522",
|
||||
"mediaset-extra": "129",
|
||||
"cielo": "4120",
|
||||
"rai-sport": "17714",
|
||||
"rai-news": "17711",
|
||||
"dmax": "15202",
|
||||
"real-time": "15201",
|
||||
"focus": "134",
|
||||
"giallo": "4322",
|
||||
"topcrime": "132",
|
||||
"boing": "126",
|
||||
"cartoonito": "133",
|
||||
"k2": "15204",
|
||||
"foodnetwork": "15203",
|
||||
"hgtv": "4334",
|
||||
"solocalcio": "4996" ,
|
||||
"euronews": "2017",
|
||||
"rai-4k": "3407",
|
||||
"""
|
||||
convert_bho_1 = {
|
||||
"euronews": "PlutoEuronews.it",
|
||||
"cartoonito": "cartoonito",
|
||||
"sky-tg-24": "skytg24",
|
||||
"frisbee": "frisbee",
|
||||
"hgtv": "hgtv",
|
||||
"k2": "k2",
|
||||
"supertennis": "supertennis",
|
||||
"solocalcio": "sportitaliasolocalcio",
|
||||
"sportitalia": "sportitalia",
|
||||
"sportitalia24": "RakutenSportItalia.it",
|
||||
"rsi-la-2": "rsila2",
|
||||
"baby-shark-tv": "RakutenBabySharkTv.it",
|
||||
"adrenaline-movies": "RakutenFullMoon.it",
|
||||
"adrenaline-movies": "RakutenBizzarroMovies.it",
|
||||
"cinema-italiano": "RakutenCinemaItalianoRakutenTv.it",
|
||||
"le-vite-degli-altri": "RakutenLeViteDegliAltri.it",
|
||||
"dark-matter": "RakutenDarkMatterItNew.it",
|
||||
"cine-western": "RakutenWesternEPeplum.it",
|
||||
"serie-crime": "RakutenCrimeSeriesItRakutenTv.it",
|
||||
"filmrise-sci-fi": "RakutenFuelTvNew.it",
|
||||
"doctor-who": "RakutenBbcDoctorWho.it",
|
||||
"bbc-drama": "RakutenBbcDrama.it",
|
||||
"documentari": "RakutenDocumentaries.it",
|
||||
"house-of-docs": "RakutenHouseOfDocs.it",
|
||||
"the-asylum": "PlutoTheAsylum.it",
|
||||
"western": "PlutoTvWestern.it",
|
||||
"consulenze-illegali": "PlutoConsulenzeIllegaliItPlus.it"
|
||||
|
||||
}
|
||||
|
||||
|
||||
convert_bho_2 = {
|
||||
"rai-1": "Rai%201",
|
||||
"rai-2": "Rai 2",
|
||||
"rai-3": "Rai 3",
|
||||
"rai-4": "Rai 4",
|
||||
"rai-premium": "Rai Premium",
|
||||
"rai-movie": "Rai Movie",
|
||||
"rai-sport": "Rai Sport",
|
||||
"rete-4": "Rete 4",
|
||||
"canale-5": "Canale 5",
|
||||
"italia-1": "Italia 1",
|
||||
"topcrime": "Top Crime",
|
||||
"mediaset-extra": "Mediaset Extra",
|
||||
"focus": "Focus",
|
||||
"boing": "Boing",
|
||||
"history": "History",
|
||||
"comedy-central": "Comedy Central",
|
||||
"tv8": "TV 8",
|
||||
"cielo": "Cielo",
|
||||
"sky-cinema-action": "Sky Cinema Action",
|
||||
"sky-arte": "Sky Arte FHD",
|
||||
"sky-atlantic": "Sky Atlantic",
|
||||
"sky-cinema-collection": "Sky Cinema Collection",
|
||||
"sky-cinema-comedy": "Sky Cinema Comedy",
|
||||
"sky-cinema-drama": "Sky Cinema Drama",
|
||||
"sky-cinema-due": "Sky Cinema Due",
|
||||
"sky-cinema-family": "Sky Cinema Family",
|
||||
"sky-cinema-romance": "Sky Cinema Romance",
|
||||
"sky-cinema-suspence": "Sky Cinema Suspence",
|
||||
"sky-cinema-uno": "Sky Cinema Uno",
|
||||
"sky-uno": "Sky Uno",
|
||||
"sky-sport-24": "Sky Sport",
|
||||
"sky-sport-uno": "Sky Sport Uno",
|
||||
"sky-sport-f1": "Sky Sport F1",
|
||||
"sky-sport-motogp": "Sky Sport MotoGP",
|
||||
"sky-sport-arena": "Sky Sport Arena",
|
||||
"sky-sport-nba": "Sky Sport NBA",
|
||||
"eurosport-1": "Eurosport 1",
|
||||
"eurosport-2": "Eurosport 2",
|
||||
"dmax": "Dmax",
|
||||
"foodnetwork": "Food Network",
|
||||
"giallo": "Giallo",
|
||||
"nove": "Nove",
|
||||
"realtime": "Real Time",
|
||||
}
|
||||
convert_bho_3 = {
|
||||
"la7": "La7",
|
||||
"rai-news": "Rai News DTT",
|
||||
"sky-crime": "Sky CrimeInvestigation",
|
||||
"sky-documentaries": "Sky Documentaries HD",
|
||||
"sky-investigation": "Sky Investigation HD",
|
||||
"sky-nature": "Sky Nature HD",
|
||||
"sky-serie": "Sky Serie HD",
|
||||
"sky-sport-golf": "Sky Sport Golf",
|
||||
"sky-sport-251": "Sky Sport 251 HD",
|
||||
"sky-sport-252": "Sky Sport 252 HD",
|
||||
"sky-sport-253": "Sky Sport 253 HD",
|
||||
"sky-sport-254": "Sky Sport 254 HD",
|
||||
"sky-sport-255": "Sky Sport 255 HD",
|
||||
"sky-sport-256": "Sky Sport 256 HD",
|
||||
"sky-sport-257": "Sky Sport 257 HD",
|
||||
"sky-sport-258": "Sky Sport 258 HD",
|
||||
"sky-sport-259": "Sky Sport 259 HD",
|
||||
"sky-sport-260": "Sky Sport 260 HD",
|
||||
"sky-sport-261": "Sky Sport 261 HD",
|
||||
"sky-sport-max": "Sky Sport Max",
|
||||
"sky-sport-calcio": "Sky Sport Calcio HD",
|
||||
"sky-sport-tennis": "Sky Sport Tennis HD",
|
||||
}
|
||||
|
||||
|
||||
async def tivu_get(id,client):
|
||||
try:
|
||||
cookies = {
|
||||
'ASP.NET_SessionId': 'p2fk5silp5mjgtx0j5chjrh3',
|
||||
}
|
||||
ik = tivu[id]
|
||||
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',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Origin': 'https://www.tivu.tv',
|
||||
'DNT': '1',
|
||||
'Sec-GPC': '1',
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': 'https://www.tivu.tv/schedasat-rai1.html',
|
||||
# 'Cookie': 'ASP.NET_SessionId=p2fk5silp5mjgtx0j5chjrh3',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
'Pragma': 'no-cache',
|
||||
'Cache-Control': 'no-cache',
|
||||
}
|
||||
|
||||
data = {
|
||||
'ik': ik
|
||||
}
|
||||
response = await client.post('https://www.tivu.tv/getPrograms.ashx', cookies=cookies, headers=headers, data=data)
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
tr_element = soup.find('tr', class_='in_onda')
|
||||
hour_range = tr_element.find_all('td')[0].text.strip()
|
||||
program_name = tr_element.find_all('td')[1].text.strip()
|
||||
description = hour_range + " " + program_name
|
||||
return description
|
||||
except Exception as e:
|
||||
print(e)
|
||||
description = f'Watch {id}'
|
||||
return description
|
||||
|
||||
|
||||
|
||||
async def epg_guide(id,client):
|
||||
import httpx
|
||||
try:
|
||||
if id in convert_bho_1:
|
||||
new_id = convert_bho_1[id]
|
||||
new_id = new_id.replace(" ","%20")
|
||||
response = await client.get(f"https://lorempizza-boh.hf.space/{new_id}/now")
|
||||
elif id in convert_bho_2:
|
||||
new_id = convert_bho_2[id]
|
||||
new_id = new_id.replace(" ","%20")
|
||||
response = await client.get(f"https://mammamia-urlo-boh2.hf.space/{new_id}/now")
|
||||
elif id in convert_bho_3:
|
||||
new_id = convert_bho_3[id]
|
||||
new_id = new_id.replace(" ","%20")
|
||||
response = await client.get(f"https://mammamia-urlo-boh3.hf.space/{new_id}/now")
|
||||
data = response.json()
|
||||
description = data['description'].replace("- EPG by epg-guide.com","").replace("No description","")
|
||||
title = data['title']
|
||||
print("MammaMia: EPG FOUND")
|
||||
return description,title
|
||||
except Exception as e:
|
||||
print(e)
|
||||
description = f'Watch {id}'
|
||||
title = ""
|
||||
return description,title
|
||||
|
||||
|
||||
|
||||
|
||||
#async def test_animeworld():
|
||||
async with httpx.AsyncClient() as client:
|
||||
test_id = "rai-news" # Replace with actual ID
|
||||
try:
|
||||
results = await epg_guide(test_id, client)
|
||||
print(results)
|
||||
except httpx.HTTPStatusError as e:
|
||||
print(f"HTTP error occurred: {e}")
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
|
||||
#if __name__ == "__main__":
|
||||
import httpx
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
@@ -0,0 +1,180 @@
|
||||
|
||||
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
|
||||
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
|
||||
WOA = 0
|
||||
#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 search(query,date,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')
|
||||
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
|
||||
release_date = date_string[-4:]
|
||||
if WOA:
|
||||
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")
|
||||
if release_date == date:
|
||||
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("")
|
||||
|
||||
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):
|
||||
#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")
|
||||
|
||||
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
|
||||
|
||||
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):
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
type = "Filmpertutti"
|
||||
if ismovie == 0 :
|
||||
season = general[2]
|
||||
episode = int(general[3])
|
||||
if "tt" in imdb:
|
||||
if ismovie == 0:
|
||||
#Get showname and date
|
||||
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
|
||||
else:
|
||||
#THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB
|
||||
showname,date = await get_info_imdb(imdb_id,ismovie,type, client)
|
||||
season = None
|
||||
|
||||
elif "tmdb" in imdb:
|
||||
#Get showname and date
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
showname,date = get_info_tmdb(tmdba,ismovie,type)
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
#Build the query
|
||||
query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
|
||||
try:
|
||||
url,tid,actual_season = await search(query,date,client,season,ismovie)
|
||||
except:
|
||||
print("MammaMia: No results found for Filmpertutti")
|
||||
return 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)
|
||||
#let's get delivery link, streaming link
|
||||
streaming_link = await get_true_link(real_link,client)
|
||||
return streaming_link
|
||||
elif ismovie == 1:
|
||||
film_link = get_film(url)
|
||||
#Let's get mixdrop link
|
||||
real_link = await get_real_link(film_link,client)
|
||||
#let's get delivery link, streaming link
|
||||
streaming_link = await get_true_link(real_link,client)
|
||||
return streaming_link
|
||||
|
||||
|
||||
'''
|
||||
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 = "tt4655480:1:1" # This is an example ID format
|
||||
results = await filmpertutti(test_id, client)
|
||||
|
||||
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")
|
||||
'''
|
||||
@@ -0,0 +1,111 @@
|
||||
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'lordchannel.{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'https://lordchannel.{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'https://lordchannel.{LC_DOMAIN}/live_search/', params=params, cookies=cookies, headers=headers, allow_redirects=True, impersonate = "chrome120")
|
||||
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'https://lordchannel.{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}')
|
||||
episode = episode -1 #Index start from 0 so I need to subtract 1
|
||||
episode = div.select('tr')[2] # index is 2 because we want the correct element
|
||||
video_url = episode.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'const\s+videoData\s*=\s*\[(.*?)\];'
|
||||
match = re.search(pattern, response.text)
|
||||
if match:
|
||||
video_data = match.group(1).strip().split(', ')
|
||||
url = video_data[0]
|
||||
return url
|
||||
|
||||
async def lordchannel(imdb,client):
|
||||
try:
|
||||
general = 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:
|
||||
print("MammaMia: Lordchannel Failed")
|
||||
return None,None
|
||||
|
||||
|
||||
|
||||
#async def test_animeworld():
|
||||
async with httpx.AsyncClient() as client:
|
||||
results = await lordchannel("tt6468322:1:1",client)
|
||||
print(results)
|
||||
|
||||
#if __name__ == "__main__":
|
||||
import httpx
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
@@ -0,0 +1,18 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import json
|
||||
from Src.Utilities.dictionaries import okru
|
||||
|
||||
|
||||
|
||||
async def okru_get_url(id,client):
|
||||
embed_link = okru[id]
|
||||
print(embed_link)
|
||||
response = await client.get(embed_link, allow_redirects=True, impersonate = "chrome120")
|
||||
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
|
||||
@@ -0,0 +1,257 @@
|
||||
from bs4 import BeautifulSoup
|
||||
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 json
|
||||
import random
|
||||
import re
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from fake_headers import Headers
|
||||
from Src.Utilities.loadenv import load_env
|
||||
env_vars = load_env()
|
||||
#Get domain
|
||||
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):
|
||||
#Extract the version from the main page of the site
|
||||
|
||||
|
||||
try:
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo'
|
||||
response = await client.get(base_url, headers=random_headers, allow_redirects = True, impersonate="chrome120")
|
||||
#Soup the response
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
|
||||
# Extract version
|
||||
version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version']
|
||||
return version
|
||||
except Exception as e:
|
||||
print("Couldn't find the version",e)
|
||||
version = "65e52dcf34d64173542cd2dc6b8bb75b"
|
||||
return version
|
||||
|
||||
async def search(query,date,ismovie, client,SC_FAST_SEARCH):
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
#Do a request to get the ID of serie/move and it's slug in the URL
|
||||
response = await client.get(query, headers = random_headers, allow_redirects=True,impersonate = "chrome120")
|
||||
print(response)
|
||||
response = response.json()
|
||||
|
||||
for item in response['data']:
|
||||
tid = item['id']
|
||||
slug = item['slug']
|
||||
type = item['type']
|
||||
if type == "tv":
|
||||
type = 0
|
||||
elif type == "movie":
|
||||
type = 1
|
||||
if type == ismovie:
|
||||
#Added a Check to see if the result is what it is supposed to be
|
||||
if SC_FAST_SEARCH == "0":
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
response = await client.get ( f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}', headers = random_headers, allow_redirects=True,impersonate = "chrome120")
|
||||
pattern = r'<div[^>]*class="features"[^>]*>.*?<span[^>]*>(.*?)<\/span>'
|
||||
match = re.search(pattern, response.text)
|
||||
print(match.group(1).split("-")[0])
|
||||
first_air_year = match.group(1).split("-")[0]
|
||||
date = int(date)
|
||||
first_air_year = int(first_air_year)
|
||||
if first_air_year == date:
|
||||
return tid,slug
|
||||
elif SC_FAST_SEARCH == "1":
|
||||
return tid,slug
|
||||
else:
|
||||
print("Couldn't find anything")
|
||||
|
||||
|
||||
async def get_film(tid,version,client):
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
random_headers['x-inertia'] = "true"
|
||||
random_headers['x-inertia-version'] = version
|
||||
#Access the iframe
|
||||
url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}'
|
||||
response = await client.get(url, headers=random_headers, allow_redirects=True,impersonate = "chrome120")
|
||||
iframe = BeautifulSoup(response.text, 'lxml')
|
||||
#Get the link of iframe
|
||||
iframe = iframe.find('iframe').get("src")
|
||||
#Get the ID containted in the src of iframe
|
||||
vixid = iframe.split("/embed/")[1].split("?")[0]
|
||||
parsed_url = urlparse(iframe)
|
||||
query_params = parse_qs(parsed_url.query)
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
random_headers['x-inertia'] = "true"
|
||||
random_headers['x-inertia-version'] = version
|
||||
#Get real token and expires by looking at the page in the iframe, vixcloud/embed
|
||||
resp = await client.get(iframe, headers = random_headers, allow_redirects=True,impersonate= "chrome120")
|
||||
soup= BeautifulSoup(resp.text, "lxml")
|
||||
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)
|
||||
quality = re.search(r'"quality":(\d+)', script).group(1)
|
||||
#Example url https://vixcloud.co/playlist/231315?b=1&token=bce060eec3dc9d1965a5d258dc78c964&expires=1728995040&rendition=1080p
|
||||
url = f'https://vixcloud.co/playlist/{vixid}?token={token}&expires={expires}'
|
||||
if 'canPlayFHD' in query_params:
|
||||
canPlayFHD = 'h=1'
|
||||
url += "&h=1"
|
||||
if 'b' in query_params:
|
||||
b = 'b=1'
|
||||
url += "&b=1"
|
||||
url720 = f'https://vixcloud.co/playlist/{vixid}'
|
||||
return url,url720,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['x-inertia'] = "true"
|
||||
random_headers['x-inertia-version'] = version
|
||||
#Set some basic headers for the request
|
||||
#Get episode ID
|
||||
response = await client.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=random_headers, allow_redirects=True, impersonate = "chrome120")
|
||||
# Print the json got
|
||||
json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
|
||||
for dict_episode in json_response:
|
||||
if dict_episode['number'] == episode:
|
||||
return dict_episode['id']
|
||||
|
||||
async def get_episode_link(episode_id,tid,version,client):
|
||||
#The parameters for the request
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
params = {
|
||||
'episode_id': episode_id,
|
||||
'next_episode': '1'
|
||||
}
|
||||
#Let's try to get the link from iframe source
|
||||
# Make a request to get iframe source
|
||||
response = await client.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params, headers = random_headers, allow_redirects=True, impersonate = "chrome120")
|
||||
|
||||
# Parse response with BeautifulSoup to get iframe source
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
iframe = soup.find("iframe").get("src")
|
||||
vixid = iframe.split("/embed/")[1].split("?")[0]
|
||||
random_headers = headers.generate()
|
||||
random_headers['Referer'] = "https://streamingcommunity.buzz/"
|
||||
random_headers['Origin'] = "https://streamingcommunity.buzz"
|
||||
random_headers['x-inertia'] = "true"
|
||||
random_headers['x-inertia-version'] = version
|
||||
parsed_url = urlparse(iframe)
|
||||
query_params = parse_qs(parsed_url.query)
|
||||
#Get real token and expires by looking at the page in the iframe, vixcloud/embed
|
||||
resp = await client.get(iframe, headers = random_headers, allow_redirects=True, impersonate = "chrome120")
|
||||
soup= BeautifulSoup(resp.text, "lxml")
|
||||
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)
|
||||
quality = re.search(r'"quality":(\d+)', script).group(1)
|
||||
#Example url https://vixcloud.co/playlist/231315?b=1&token=bce060eec3dc9d1965a5d258dc78c964&expires=1728995040&rendition=1080p
|
||||
url = f'https://vixcloud.co/playlist/{vixid}?token={token}&expires={expires}'
|
||||
if 'canPlayFHD' in query_params:
|
||||
canPlayFHD = 'h=1'
|
||||
url += "&h=1"
|
||||
if 'b' in query_params:
|
||||
b = 'b=1'
|
||||
url += "&b=1"
|
||||
url720 = f'https://vixcloud.co/playlist/{vixid}'
|
||||
return url,url720,quality
|
||||
|
||||
|
||||
async def streaming_community(imdb,client,SC_FAST_SEARCH):
|
||||
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/{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
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
if ismovie == 0 :
|
||||
season = int(general[2])
|
||||
episode = int(general[3])
|
||||
#Check if fast search is enabled or disabled
|
||||
if SC_FAST_SEARCH == "1":
|
||||
type = "StreamingCommunityFS"
|
||||
if "tt" in imdb:
|
||||
#Get showname
|
||||
showname = await get_info_imdb(imdb_id,ismovie,type,client)
|
||||
date = None
|
||||
else:
|
||||
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
|
||||
date = None
|
||||
#else just equals them
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
showname = get_info_tmdb(tmdba,ismovie,type)
|
||||
elif SC_FAST_SEARCH == "0":
|
||||
type = "StreamingCommunity"
|
||||
tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
|
||||
showname,date = get_info_tmdb(tmdba,ismovie,type)
|
||||
#HERE THE CASE IF IT IS A MOVIE
|
||||
else:
|
||||
if SC_FAST_SEARCH == "1":
|
||||
type = "StreamingCommunity"
|
||||
if "tt" in imdb:
|
||||
#Get showname
|
||||
date = None
|
||||
showname = await get_info_imdb(imdb_id,ismovie,type,client)
|
||||
else:
|
||||
date = None
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
showname = get_info_tmdb(tmdba,ismovie,type)
|
||||
elif SC_FAST_SEARCH == "0":
|
||||
if "tt" in imdb:
|
||||
#Get showname
|
||||
showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
|
||||
else:
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
showname,date = get_info_tmdb(tmdba,ismovie,type)
|
||||
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
||||
version = await get_version(client)
|
||||
tid,slug = await search(query,date,ismovie,client,SC_FAST_SEARCH)
|
||||
if ismovie == 1:
|
||||
#TID means temporaly ID
|
||||
url,url720,quality = await get_film(tid,version,client)
|
||||
print("MammaMia found results for StreamingCommunity")
|
||||
return url,url720,quality
|
||||
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)
|
||||
print("MammaMia found results for StreamingCommunity")
|
||||
return url,url720,quality
|
||||
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:
|
||||
# Replace with actual id, for example 'anime_id:episode' format
|
||||
test_id = "tt16288804:1:1" # This is an example ID format
|
||||
results = await streaming_community(test_id, client,"0")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
@@ -0,0 +1,98 @@
|
||||
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
|
||||
SW_DOMAIN = config.SW_DOMAIN
|
||||
async def search(showname,season,episode,date,ismovie,client):
|
||||
if ismovie == 1:
|
||||
query = f'https://www.streamingwatch.{SW_DOMAIN}/wp-admin/admin-ajax.php'
|
||||
headers = {
|
||||
'authority': f'www.streamingwatch.{SW_DOMAIN}',
|
||||
'accept': '*/*',
|
||||
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
# 'cookie': 'wordpress_test_cookie=WP%20Cookie%20check',
|
||||
'origin': f'https://www.streamingwatch.{SW_DOMAIN}',
|
||||
'referer': f'https://www.streamingwatch.{SW_DOMAIN}',
|
||||
'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',
|
||||
}
|
||||
data = {
|
||||
'action': 'data_fetch',
|
||||
'keyword': showname,
|
||||
'_wpnonce': '648328b831',
|
||||
}
|
||||
cookies = {
|
||||
'wordpress_test_cookie': 'WP%20Cookie%20check',
|
||||
}
|
||||
response = await client.post(query,cookies=cookies, headers=headers, data=data)
|
||||
soup = BeautifulSoup(response.content,'lxml')
|
||||
page_date = soup.find(id = 'search-cat-year').text.strip()
|
||||
if page_date == date:
|
||||
href = soup.find('a')['href']
|
||||
response = await client.get(href, allow_redirects=True, impersonate = "chrome120")
|
||||
soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('iframe'))
|
||||
iframe = soup.find('iframe')
|
||||
hdplayer = iframe.get('data-lazy-src')
|
||||
|
||||
return hdplayer
|
||||
elif ismovie == 0:
|
||||
#Some series have the name in english so we first search with the categories option and then we use the obtained ID to get all the episodes
|
||||
id_response = await client.get(f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/categories?search={showname}&_fields=id', allow_redirects=True, impersonate = "chrome120")
|
||||
data = json.loads(id_response.text)
|
||||
category_id = data[0]['id']
|
||||
query = f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/posts?categories={category_id}&per_page=100'
|
||||
response = await client.get(query, allow_redirects=True, impersonate = "chrome120")
|
||||
data_json = response.text
|
||||
data = json.loads(data_json)
|
||||
for entry in data:
|
||||
if f"stagione-{season}-episodio-{episode}" in entry["slug"]:
|
||||
content = entry["content"]["rendered"]
|
||||
#"content":{
|
||||
# "rendered":"<p><!--baslik:PRO--><iframe loading=\"lazy\" src=\"https:\/\/hdplayer.gives\/embed\/YErLVq64uNTZRNz\" frameborder=\"0\" width=\"700\" height=\"400\" allowfullscreen><\/iframe><\/p>\n","protected":false}
|
||||
start = content.find('src="') + len('src="') #start of url
|
||||
end = content.find('"', start) #end of url
|
||||
hdplayer = content[start:end]
|
||||
return hdplayer
|
||||
async def hls_url(hdplayer,client):
|
||||
response = await client.get(hdplayer, allow_redirects=True, impersonate = "chrome120")
|
||||
match = re.search(r'sources:\s*\[\s*\{\s*file\s*:\s*"([^"]*)"', response.text)
|
||||
url = match.group(1)
|
||||
return url
|
||||
async def streamingwatch(imdb,client):
|
||||
try:
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
type = "StreamingWatch"
|
||||
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)
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
hdplayer = await search(showname,season,episode,date,ismovie,client)
|
||||
url = await hls_url(hdplayer,client)
|
||||
print("MammaMia: StreamingWatch found results for StreamingCommunity")
|
||||
return url
|
||||
except:
|
||||
print("MammaMia: StreamingWatch Failed")
|
||||
return None
|
||||
@@ -0,0 +1,282 @@
|
||||
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
|
||||
HF = config.HF
|
||||
env_vars = load_env()
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
TF_DOMAIN = config.TF_DOMAIN
|
||||
|
||||
async def search(showname,ismovie,date,client):
|
||||
showname = showname.replace(" ","%20")
|
||||
url = f'https://www.tanti.bond/ajax/posts?q={showname}'
|
||||
response = await client.post(url, allow_redirects=True, impersonate = "chrome120")
|
||||
response = response.json()['data']
|
||||
if ismovie == 1:
|
||||
for link in response:
|
||||
url = link['url']
|
||||
response = 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'https://www.tanti.{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"https://www.tanti.{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 = true_url(protect_link)
|
||||
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"https://www.tanti.{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/",
|
||||
}
|
||||
if HF == "1":
|
||||
proxy = PROXY_CREDENTIALS
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
response = await client.get(protect_link, proxies=proxies, allow_redirects=True, impersonate = "chrome120")
|
||||
else:
|
||||
response = await client.get(protect_link, allow_redirects=True, impersonate = "chrome120")
|
||||
link = response.url
|
||||
|
||||
|
||||
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(url, headers=headers, allow_redirects=True, impersonate = "chrome120")
|
||||
real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
|
||||
print("MammaMia: Found results for Tantifilm")
|
||||
return real_url
|
||||
else:
|
||||
print("No match found in the text.")
|
||||
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 = 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 = "tt6468322:1:1" # This is an example ID format
|
||||
results = await tantifilm(test_id, client,"0")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import random
|
||||
import Src.Utilities.config as config
|
||||
from Src.Utilities.dictionaries import webru_vary,webru_dlhd
|
||||
from Src.Utilities.loadenv import load_env
|
||||
env_vars = load_env()
|
||||
MEDIAFLOW_PASS = env_vars.get('MEDIAFLOW_PASS')
|
||||
Referer = "https://ilovetoplay.xyz/"
|
||||
Origin = "https://ilovetoplay.xyz"
|
||||
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",
|
||||
}
|
||||
medialink = config.MediaProxy
|
||||
async def get_stream_link(id,site,client):
|
||||
try:
|
||||
if site == "dlhd":
|
||||
m3u8_url = webru_dlhd[id]
|
||||
elif site == "vary":
|
||||
m3u8_url = webru_vary[id]
|
||||
response = await client.get(m3u8_url, headers=headers, allow_redirects=False, impersonate = "chrome120")
|
||||
if response.status_code == 301:
|
||||
stream_url = response.headers.get("Location", "")
|
||||
return stream_url,Referer,Origin
|
||||
except Exception as e:
|
||||
return None
|
||||
async def webru(id,site,client):
|
||||
try:
|
||||
stream_url, Referer,Origin = await get_stream_link(id,site,client)
|
||||
mediaproxy = config.MediaProxy
|
||||
medialink = random.choice(mediaproxy)
|
||||
new_stream_url = f'{medialink}proxy/hls?key_url=https%3A%2F%2Fkey.mizhls.ru%2F&api_password={MEDIAFLOW_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
|
||||
Reference in New Issue
Block a user