Added async support

This commit is contained in:
UrloMythus
2024-08-26 17:13:45 +02:00 Unverified
parent 56382986fc
commit be907313da
12 changed files with 210 additions and 211 deletions
+13 -12
View File
@@ -5,16 +5,16 @@ import json
from info import get_info_kitsu from info import get_info_kitsu
import config import config
AW_DOMAIN = config.AW_DOMAIN AW_DOMAIN = config.AW_DOMAIN
def get_mp4(anime_url,ismovie,episode): async def get_mp4(anime_url,ismovie,episode,client):
response = requests.get(anime_url) response = await client.get(anime_url,follow_redirects=True)
soup = BeautifulSoup(response.text,'lxml') soup = BeautifulSoup(response.text,'lxml')
episode_page = soup.find('a', {'data-episode-num':episode }) episode_page = soup.find('a', {'data-episode-num':episode })
episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}' episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}'
response = requests.get(episode_page) response = await client.get(episode_page,follow_redirects=True)
soup = BeautifulSoup(response.text,'lxml') soup = BeautifulSoup(response.text,'lxml')
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'}) a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
url = a_tag['href'] url = a_tag['href']
response = requests.head(url) response = await client.head(url)
if response.status_code == 404: if response.status_code == 404:
url = None url = None
return url return url
@@ -25,7 +25,7 @@ def get_mp4(anime_url,ismovie,episode):
def search(showname,date,ismovie,episode): async def search(showname,date,ismovie,episode,client):
cookies = { cookies = {
'sessionId': 's%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ', 'sessionId': 's%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ',
} }
@@ -53,7 +53,7 @@ def search(showname,date,ismovie,episode):
'keyword': showname, 'keyword': showname,
} }
response = requests.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers) response = await client.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers,follow_redirects=True)
months = { months = {
"Gennaio": "January", "Febbraio": "February", "Marzo": "March", "Gennaio": "January", "Febbraio": "February", "Marzo": "March",
"Aprile": "April", "Maggio": "May", "Giugno": "June", "Aprile": "April", "Maggio": "May", "Giugno": "June",
@@ -72,14 +72,14 @@ def search(showname,date,ismovie,episode):
identifier = anime["identifier"] identifier = anime["identifier"]
link = anime["link"] link = anime["link"]
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}' anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
final_url = get_mp4(anime_url,ismovie,episode) final_url = await get_mp4(anime_url,ismovie,episode,client)
final_urls.append(final_url) final_urls.append(final_url)
break break
showname = showname + " (ITA)" showname = showname + " (ITA)"
params = { params = {
'keyword': showname, 'keyword': showname,
} }
response = requests.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers) response = await client.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers, follow_redirects=True)
data = json.loads(response.text) data = json.loads(response.text)
for anime in data["animes"]: for anime in data["animes"]:
release_date = anime["release"] release_date = anime["release"]
@@ -91,17 +91,18 @@ def search(showname,date,ismovie,episode):
identifier = anime["identifier"] identifier = anime["identifier"]
link = anime["link"] link = anime["link"]
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}' anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
final_url = get_mp4(anime_url,ismovie,episode) final_url = await get_mp4(anime_url,ismovie,episode,client)
final_urls.append(final_url) final_urls.append(final_url)
break break
return final_urls return final_urls
def animeworld(id):
async def animeworld(id,client):
try: try:
kitsu_id = id.split(":")[1] kitsu_id = id.split(":")[1]
episode = id.split(":")[2] episode = id.split(":")[2]
ismovie = 1 if len(id.split(":")) == 2 else 0 ismovie = 1 if len(id.split(":")) == 2 else 0
showname,date = get_info_kitsu(kitsu_id) showname,date = await get_info_kitsu(kitsu_id,client)
final_urls = search(showname,date,ismovie,episode) final_urls = await search(showname,date,ismovie,episode,client)
print(final_urls) print(final_urls)
return final_urls return final_urls
except: except:
+3 -3
View File
@@ -2,15 +2,15 @@
"Siti": { "Siti": {
"StreamingCommunity": { "StreamingCommunity": {
"enabled": "1", "enabled": "1",
"domain": "photos", "domain": "buzz",
"fast_search": "0" "fast_search": "0"
}, },
"Filmpertutti": { "Filmpertutti": {
"enabled": "0", "enabled": "0",
"domain": "makeup" "domain": "diy"
}, },
"Tuttifilm":{ "Tuttifilm":{
"enabled": "1", "enabled": "0",
"domain": "bond", "domain": "bond",
"fast_search": "0" "fast_search": "0"
}, },
+2 -2
View File
@@ -5,8 +5,8 @@ import config
env_vars = load_env() env_vars = load_env()
TMDB_KEY = env_vars.get('TMDB_KEY') TMDB_KEY = env_vars.get('TMDB_KEY')
def get_TMDb_id_from_IMDb_id(imdb_id): async def get_TMDb_id_from_IMDb_id(imdb_id,client):
response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}', response = await client.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'}) params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
tmbda = response.json() tmbda = response.json()
if tmbda['movie_results']: if tmbda['movie_results']:
+11 -12
View File
@@ -5,12 +5,12 @@ from convert import get_TMDb_id_from_IMDb_id
from loadenv import load_env from loadenv import load_env
env_vars = load_env() env_vars = load_env()
MYSTERIUS_KEY = env_vars.get('MYSTERIUS_KEY') MYSTERIUS_KEY = env_vars.get('MYSTERIUS_KEY')
def get_links(slug,season,episode,ismovie): async def get_links(slug,season,episode,ismovie,client):
try: try:
headers = { headers = {
"x-api-key": MYSTERIUS_KEY "x-api-key": MYSTERIUS_KEY
} }
response = requests.get("https://mammamia-urlo-ulala12431.hf.space/api/cookie", headers=headers) response = await client.get("https://mammamia-urlo-ulala12431.hf.space/api/cookie", headers=headers)
Auths = response.json() Auths = response.json()
Bearer = Auths.get('cookie') Bearer = Auths.get('cookie')
ap_session = Auths.get('auth') ap_session = Auths.get('auth')
@@ -27,16 +27,15 @@ def get_links(slug,season,episode,ismovie):
} }
if ismovie == 1: if ismovie == 1:
response = requests.get(f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers) response = await client.get(f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers)
elif ismovie == 0: elif ismovie == 0:
print("HERE SEASON",season) print("HERE SEASON",season)
print("HERE EPISODE",episode) print("HERE EPISODE",episode)
request_url =f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}/{season}/{episode}' request_url =f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}/{season}/{episode}'
print(request_url) print(request_url)
response = requests.get(request_url,cookies=cookies,headers=headers) response = await client.get(request_url,cookies=cookies,headers=headers)
try: try:
video_data = response.json() # Assuming this is the JSON response containing video streams video_data = response.json() # Assuming this is the JSON response containing video streams
if 'streams' not in video_data: if 'streams' not in video_data:
print("Invalid JSON format: 'streams' key not found or incorrect structure") print("Invalid JSON format: 'streams' key not found or incorrect structure")
return None return None
@@ -79,10 +78,10 @@ def get_links(slug,season,episode,ismovie):
def search_imdb(showname,tmdba): async def search_imdb(showname,tmdba,client):
tmdba = str(tmdba) tmdba = str(tmdba)
query = f'https://altadefinizione-originale.com/api/search?search={showname}&page=1' query = f'https://altadefinizione-originale.com/api/search?search={showname}&page=1'
response = requests.get(query) response = await client.get(query,follow_redirects=True)
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
if 'data' in data: if 'data' in data:
@@ -108,7 +107,7 @@ def parse_links(resolution_links):
print("Failed to fetch video links") print("Failed to fetch video links")
def cool(imdb): async def cool(imdb,client):
try: try:
type = "Cool" type = "Cool"
general = is_movie(imdb) general = is_movie(imdb)
@@ -120,19 +119,19 @@ def cool(imdb):
if "tt" in imdb: if "tt" in imdb:
#Get showname #Get showname
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else: else:
tmdba = imdb_id.replace("tmdb:","") tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type) showname = get_info_tmdb(tmdba,ismovie,type)
slug = search_imdb(showname,tmdba) slug = await search_imdb(showname,tmdba,client)
print(ismovie) print(ismovie)
if ismovie == 1: if ismovie == 1:
season = None season = None
episode = None episode = None
resolution_links = get_links(slug,episode,season,ismovie) resolution_links = await get_links(slug,episode,season,ismovie,client)
results = parse_links(resolution_links) results = parse_links(resolution_links)
return results return results
elif ismovie == 0: elif ismovie == 0:
@@ -142,5 +141,5 @@ def cool(imdb):
results = parse_links(resolution_links) results = parse_links(resolution_links)
return results return results
except Exception as e: except Exception as e:
print("Cool Error") print("Cool Error",e)
return None return None
+18 -18
View File
@@ -26,13 +26,13 @@ month_mapping = {
'Sep': 'Settembre', 'Oct': 'Ottobre', 'Nov': 'Novembre', 'Dec': 'Dicembre' 'Sep': 'Settembre', 'Oct': 'Ottobre', 'Nov': 'Novembre', 'Dec': 'Dicembre'
} }
def search(query,date): async def search(query,date,client):
response = requests.get(query).json() response = await client.get(query).json()
#Get link tid of every item and then open the link to see if the date = date #Get link tid of every item and then open the link to see if the date = date
for json in response: for json in response:
link = json['link'] link = json['link']
tid = json['id'] tid = json['id']
series_response = requests.get(link, headers=headers) series_response = await client.get(link, headers=headers, follow_redirects=True)
series_soup = BeautifulSoup(series_response.text, 'lxml') series_soup = BeautifulSoup(series_response.text, 'lxml')
release_span = series_soup.find('span', class_='released') release_span = series_soup.find('span', class_='released')
if release_span: if release_span:
@@ -61,22 +61,22 @@ def get_film(url):
tlink = url + "?show_video=true" tlink = url + "?show_video=true"
return tlink return tlink
def get_real_link(tlink): async def get_real_link(tlink,client):
#Some basic code to get the mixdrop link #Some basic code to get the mixdrop link
page = requests.get(tlink, headers=headers) page = await client.get(tlink, headers=headers, follow_redirects=True)
soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(page.content(), features="lxml",parse_only=SoupStrainer('iframe'))
iframe_src = soup.find('iframe')['src'] iframe_src = soup.find('iframe')['src']
iframe_page = requests.get(iframe_src, headers=headers) iframe_page = await client.get(iframe_src, headers=headers, follow_redirects=True)
iframe_soup = BeautifulSoup(iframe_page.content, features="lxml") iframe_soup = BeautifulSoup(iframe_page.content(), features="lxml")
mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP') mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP')
if mega_button: if mega_button:
real_link = mega_button.get('meta-link') real_link = mega_button.get('meta-link')
return real_link return real_link
def get_true_link(real_link): async def get_true_link(real_link,client):
response = requests.get(real_link, headers=headers) response = await client.get(real_link, headers=headers, follow_redirects=True)
[s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2) [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2)
schema = s1.split(";")[2][5:-1] schema = s1.split(";")[2][5:-1]
terms = s2.split("|") terms = s2.split("|")
@@ -89,7 +89,7 @@ def get_true_link(real_link):
s += d[c] if c in d else c s += d[c] if c in d else c
return s return s
def filmpertutti(imdb): async def filmpertutti(imdb,client):
general = is_movie(imdb) general = is_movie(imdb)
ismovie = general[0] ismovie = general[0]
imdb_id = general[1] imdb_id = general[1]
@@ -100,10 +100,10 @@ def filmpertutti(imdb):
if "tt" in imdb: if "tt" in imdb:
if ismovie == 0: if ismovie == 0:
#Get showname and date #Get showname and date
showname,date = get_info_imdb(imdb_id,ismovie,type) showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
else: else:
#THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB #THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
showname,date = get_info_tmdb(tmdba,ismovie,type) showname,date = get_info_tmdb(tmdba,ismovie,type)
elif "tmdb" in imdb: elif "tmdb" in imdb:
@@ -114,23 +114,23 @@ def filmpertutti(imdb):
#Build the query #Build the query
query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id' query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
try: try:
url,tid = search(query,date) url,tid = await search(query,date,client)
except: except:
print("No results found") print("No results found")
return None return None
if ismovie == 0: if ismovie == 0:
episode_link = get_episode_link(season,episode,tid,url) episode_link = get_episode_link(season,episode,tid,url)
#Let's get mixdrop link #Let's get mixdrop link
real_link = get_real_link(episode_link) real_link = await get_real_link(episode_link,client)
#let's get delivery link, streaming link #let's get delivery link, streaming link
streaming_link = get_true_link(real_link) streaming_link = await get_true_link(real_link,client)
print(streaming_link) print(streaming_link)
return streaming_link return streaming_link
elif ismovie == 1: elif ismovie == 1:
film_link = get_film(url) film_link = get_film(url)
#Let's get mixdrop link #Let's get mixdrop link
real_link = get_real_link(film_link) real_link = await get_real_link(film_link,client)
#let's get delivery link, streaming link #let's get delivery link, streaming link
streaming_link = get_true_link(real_link) streaming_link = await get_true_link(real_link,client)
print(streaming_link) print(streaming_link)
return streaming_link return streaming_link
+4 -4
View File
@@ -85,9 +85,9 @@ def get_info_tmdb(tmbda,ismovie,type):
print("Real date",date) print("Real date",date)
return showname,date return showname,date
def get_info_imdb(imdb_id, ismovie, type): async def get_info_imdb(imdb_id, ismovie, type,client):
resp = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}?api_key={TMDB_KEY}&language=it&external_source=imdb_id') resp = await client.get(f'https://api.themoviedb.org/3/find/{imdb_id}?api_key={TMDB_KEY}&language=it&external_source=imdb_id')
data = resp.json() data = resp.json()
if ismovie == 0: if ismovie == 0:
showname = data['tv_results'][0]['name'] showname = data['tv_results'][0]['name']
@@ -120,9 +120,9 @@ def get_info_imdb(imdb_id, ismovie, type):
elif type == "Cool": elif type == "Cool":
return showname return showname
def get_info_kitsu(kitsu_id): async def get_info_kitsu(kitsu_id,client):
api_url = f'https://kitsu.io/api/edge/anime/{kitsu_id}' api_url = f'https://kitsu.io/api/edge/anime/{kitsu_id}'
response = requests.get(api_url) response = await client.get(api_url)
data = json.loads(response.text) data = json.loads(response.text)
showname = data['data']['attributes']['canonicalTitle'] showname = data['data']['attributes']['canonicalTitle']
date = data['data']['attributes']['startDate'] date = data['data']['attributes']['startDate']
+12 -12
View File
@@ -10,17 +10,17 @@ import config
import re import re
import json import json
LC_DOMAIN = config.LC_DOMAIN LC_DOMAIN = config.LC_DOMAIN
def search(showname,date,season,episode,ismovie): async def search(showname,date,season,episode,ismovie,client):
cookies = { cookies = {
'csrftoken': '7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ', 'csrftoken': '7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ',
} }
headers = { headers = {
'authority': 'lordchannel.com', 'authority': f'lordchannel.{LC_DOMAIN}',
'accept': '*/*', 'accept': '*/*',
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7', 'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
# 'cookie': 'csrftoken=7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ', # 'cookie': 'csrftoken=7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ',
'referer': 'https://lordchannel.com/anime/anime-ita/', 'referer': f'https://lordchannel.{LC_DOMAIN}/anime/anime-ita/',
'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"', 'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"',
'sec-ch-ua-mobile': '?0', 'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Android"', 'sec-ch-ua-platform': '"Android"',
@@ -36,14 +36,14 @@ def search(showname,date,season,episode,ismovie):
'_': '1724421723999', '_': '1724421723999',
} }
response = requests.get('https://lordchannel.com/live_search/', params=params, cookies=cookies, headers=headers) response = await client.get(f'https://lordchannel.{LC_DOMAIN}/live_search/', params=params, cookies=cookies, headers=headers, follow_redirects=True)
data = json.loads(response.text) data = json.loads(response.text)
for entry in data['data']: for entry in data['data']:
if entry is not None: # check if the a_tag exists if entry is not None: # check if the a_tag exists
href = entry['url'] href = entry['url']
quality = entry['qualit\u00e0_video'] quality = entry['qualit\u00e0_video']
link = f'https://lordchannel.{LC_DOMAIN}{href}' link = f'https://lordchannel.{LC_DOMAIN}{href}'
response = requests.get(link) response = await client.get(link, follow_redirects=True)
soup2 = BeautifulSoup(response.text,'lxml') soup2 = BeautifulSoup(response.text,'lxml')
li_tag = soup2.select_one("ul.card__meta li:nth-of-type(2)") 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 if li_tag is not None: # check if the li_tag exists
@@ -63,8 +63,8 @@ def search(showname,date,season,episode,ismovie):
print("Sadly date are not equals") print("Sadly date are not equals")
continue continue
def get_m3u8(video_url): async def get_m3u8(video_url,client):
response = requests.get(video_url) response = await client.get(video_url, follow_redirects=True)
pattern = r'const videoData = \[(.*?)\];' pattern = r'const videoData = \[(.*?)\];'
match = re.search(pattern, response.text) match = re.search(pattern, response.text)
@@ -73,7 +73,7 @@ def get_m3u8(video_url):
url = video_data[0] url = video_data[0]
return url return url
def lordchannel(imdb): async def lordchannel(imdb,client):
try: try:
general = is_movie(imdb) general = is_movie(imdb)
ismovie = general[0] ismovie = general[0]
@@ -83,19 +83,19 @@ def lordchannel(imdb):
season = int(general[2]) season = int(general[2])
episode = int(general[3]) episode = int(general[3])
if "tt" in imdb: if "tt" in imdb:
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else: else:
tmdba = imdb_id tmdba = imdb_id
else: else:
season = None season = None
episode = None episode = None
if "tt" in imdb: if "tt" in imdb:
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else: else:
tmdba = imdb_id tmdba = imdb_id
showname,date = get_info_tmdb(tmdba,ismovie,type) showname,date = get_info_tmdb(tmdba,ismovie,type)
video_url,quality = search(showname,date,season,episode,ismovie) video_url,quality = await search(showname,date,season,episode,ismovie,client)
url = get_m3u8(video_url) url = await get_m3u8(video_url,client)
url = url.replace('"','') url = url.replace('"','')
print(url) print(url)
return url,quality return url,quality
+2 -2
View File
@@ -5,10 +5,10 @@ from dictionaries import okru
def okru_get_url(id): async def okru_get_url(id,client):
embed_link = okru[id] embed_link = okru[id]
print(embed_link) print(embed_link)
response = requests.get(embed_link) response = await client.get(embed_link, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
div = soup.find('div', {'data-module': 'OKVideo'}) div = soup.find('div', {'data-module': 'OKVideo'})
data_options = div.get('data-options') data_options = div.get('data-options')
+11 -10
View File
@@ -104,14 +104,15 @@ def addon_meta(type, id):
} }
return respond_with({"meta": meta}) return respond_with({"meta": meta})
abort(404) raise HTTPException(status_code=404)
@app.get('/stream/{type}/{id}.json') @app.get('/stream/{type}/{id}.json')
def addon_stream(type, id): async def addon_stream(type, id):
if type not in MANIFEST['types']: if type not in MANIFEST['types']:
raise HTTPException(status_code=404) raise HTTPException(status_code=404)
streams = {'streams': []} streams = {'streams': []}
async with httpx.AsyncClient() as client:
if type == "tv": if type == "tv":
for channel in STREAM["channels"]: for channel in STREAM["channels"]:
if channel["id"] == id: if channel["id"] == id:
@@ -120,7 +121,7 @@ def addon_stream(type, id):
'url': channel['url'] 'url': channel['url']
}) })
if id in okru: if id in okru:
channel_url = okru_get_url(id) channel_url = await okru_get_url(id,client)
streams['streams'].append({ streams['streams'].append({
'title': channel['name'] + "OKRU", 'title': channel['name'] + "OKRU",
'url': channel_url 'url': channel_url
@@ -132,7 +133,7 @@ def addon_stream(type, id):
logging.debug(f"Handling movie or series: {id}") logging.debug(f"Handling movie or series: {id}")
if "kitsu" in id: if "kitsu" in id:
if ANIMEWORLD == "1": if ANIMEWORLD == "1":
animeworld_urls = animeworld(id) animeworld_urls = await animeworld(id,client)
print(animeworld_urls) print(animeworld_urls)
if animeworld_urls: if animeworld_urls:
i = 0 i = 0
@@ -146,12 +147,12 @@ def addon_stream(type, id):
i+=1 i+=1
else: else:
if MYSTERIUS == "1": if MYSTERIUS == "1":
results = cool(id) results = await cool(id,client)
if results: if results:
for resolution, link in results.items(): for resolution, link in results.items():
streams['streams'].append({'title': f'{HF}Mysterious {resolution}', 'url': link}) streams['streams'].append({'title': f'{HF}Mysterious {resolution}', 'url': link})
if STREAMINGCOMMUNITY == "1": if STREAMINGCOMMUNITY == "1":
url_streaming_community,url_720_streaming_community,quality_sc = streaming_community(id) url_streaming_community,url_720_streaming_community,quality_sc = await streaming_community(id,client)
if url_streaming_community is not None: if url_streaming_community is not None:
if quality_sc == "1080": if quality_sc == "1080":
streams['streams'].append({'title': f'{HF}StreamingCommunity 1080p Max', 'url': url_streaming_community}) streams['streams'].append({'title': f'{HF}StreamingCommunity 1080p Max', 'url': url_streaming_community})
@@ -159,23 +160,23 @@ def addon_stream(type, id):
else: else:
streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_streaming_community}) streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_streaming_community})
if LORDCHANNEL == "1": if LORDCHANNEL == "1":
url_lordchannel,quality_lordchannel =lordchannel(id) url_lordchannel,quality_lordchannel = await lordchannel(id,client)
if quality_lordchannel == "FULL HD" and url_lordchannel != None: if quality_lordchannel == "FULL HD" and url_lordchannel != None:
streams['streams'].append({'title': f'{HF}LordChannel 1080p', 'url': url_lordchannel}) streams['streams'].append({'title': f'{HF}LordChannel 1080p', 'url': url_lordchannel})
elif url_lordchannel != None: elif url_lordchannel != None:
streams['streams'].append({'title': f'{HF}LordChannel 720p', 'url': url_lordchannel}) streams['streams'].append({'title': f'{HF}LordChannel 720p', 'url': url_lordchannel})
if FILMPERTUTTI == "1": if FILMPERTUTTI == "1":
url_filmpertutti = filmpertutti(id) url_filmpertutti = await filmpertutti(id,client)
if url_filmpertutti is not None: if url_filmpertutti is not None:
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti}) streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
if TUTTIFILM == "1": if TUTTIFILM == "1":
url_tuttifilm = tantifilm(id) url_tuttifilm = await tantifilm(id,client)
if url_tuttifilm: if url_tuttifilm:
if not isinstance(url_tuttifilm, str): if not isinstance(url_tuttifilm, str):
for title, url in url_tuttifilm.items(): for title, url in url_tuttifilm.items():
streams['streams'].append({'title': f'{HF}Tantifilm {title}', 'url': url, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}}) streams['streams'].append({'title': f'{HF}Tantifilm {title}', 'url': url, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}})
if STREAMINGWATCH == "1": if STREAMINGWATCH == "1":
url_streamingwatch = streamingwatch(id) url_streamingwatch = await streamingwatch(id,client)
if url_streamingwatch: if url_streamingwatch:
streams['streams'].append({'title': f'{HF}StreamingWatch 720p', 'url': url_streamingwatch}) streams['streams'].append({'title': f'{HF}StreamingWatch 720p', 'url': url_streamingwatch})
if not streams['streams']: if not streams['streams']:
+24 -26
View File
@@ -1,5 +1,4 @@
from tmdbv3api import TMDb, Movie, TV from tmdbv3api import TMDb, Movie, TV
import requests
import logging import logging
from bs4 import BeautifulSoup,SoupStrainer from bs4 import BeautifulSoup,SoupStrainer
from datetime import datetime from datetime import datetime
@@ -21,13 +20,13 @@ headers = {
} }
#GET VERSION OF STREAMING COMMUNITY: #GET VERSION OF STREAMING COMMUNITY:
def get_version(): async def get_version(client):
#Extract the version from the main page of the site #Extract the version from the main page of the site
try: try:
base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo' base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo'
response = requests.get(base_url, headers=headers) response = await client.get(base_url, headers=headers, follow_redirects=True)
#Soup the response #Soup the response
soup = BeautifulSoup(response.text, "lxml") soup = BeautifulSoup(response.text, "lxml")
@@ -39,9 +38,11 @@ def get_version():
version = "65e52dcf34d64173542cd2dc6b8bb75b" version = "65e52dcf34d64173542cd2dc6b8bb75b"
return version return version
def search(query,date,ismovie): async def search(query,date,ismovie, client):
#Do a request to get the ID of serie/move and it's slug in the URL #Do a request to get the ID of serie/move and it's slug in the URL
response = requests.get(query).json() response = await client.get(query, follow_redirects=True)
response = response.json()
for item in response['data']: for item in response['data']:
tid = item['id'] tid = item['id']
slug = item['slug'] slug = item['slug']
@@ -54,8 +55,7 @@ def search(query,date,ismovie):
#Added a Check to see if the result is what it is supposed to be #Added a Check to see if the result is what it is supposed to be
if SC_FAST_SEARCH == "0": if SC_FAST_SEARCH == "0":
if ismovie == 0: if ismovie == 0:
# response = await client.get ( f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}', follow_redirects=True)
response = requests.get ( f'https://streamingcommunity.boston/titles/{tid}-{slug}')
pattern = r'<div[^>]*class="features"[^>]*>.*?<span[^>]*>(.*?)<\/span>' pattern = r'<div[^>]*class="features"[^>]*>.*?<span[^>]*>(.*?)<\/span>'
match = re.search(pattern, response.text) match = re.search(pattern, response.text)
print(match.group(1).split("-")[0]) print(match.group(1).split("-")[0])
@@ -72,7 +72,7 @@ def search(query,date,ismovie):
print("Couldn't find anything") print("Couldn't find anything")
def get_film(tid,version): async def get_film(tid,version,client):
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", 'user-agent': "Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537",
'x-inertia': 'true', 'x-inertia': 'true',
@@ -81,7 +81,7 @@ def get_film(tid,version):
} }
#Access the iframe #Access the iframe
url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}' url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}'
response = requests.get(url, headers=headers) response = await client.get(url, headers=headers, follow_redirects=True)
iframe = BeautifulSoup(response.text, 'lxml') iframe = BeautifulSoup(response.text, 'lxml')
#Get the link of iframe #Get the link of iframe
iframe = iframe.find('iframe').get("src") iframe = iframe.find('iframe').get("src")
@@ -90,7 +90,7 @@ def get_film(tid,version):
parsed_url = urlparse(iframe) parsed_url = urlparse(iframe)
query_params = parse_qs(parsed_url.query) query_params = parse_qs(parsed_url.query)
#Get real token and expires by looking at the page in the iframe, vixcloud/embed #Get real token and expires by looking at the page in the iframe, vixcloud/embed
resp = requests.get(iframe, headers = headers) resp = await client.get(iframe, headers = headers, follow_redirects=True)
soup= BeautifulSoup(resp.text, "lxml") soup= BeautifulSoup(resp.text, "lxml")
script = soup.find("body").find("script").text script = soup.find("body").find("script").text
token = re.search(r"'token':\s*'(\w+)'", script).group(1) token = re.search(r"'token':\s*'(\w+)'", script).group(1)
@@ -107,7 +107,7 @@ def get_film(tid,version):
url720 = f'https://vixcloud.co/playlist/{vixid}' url720 = f'https://vixcloud.co/playlist/{vixid}'
return url,url720,quality, return url,url720,quality,
def get_season_episode_id(tid,slug,season,episode,version): async def get_season_episode_id(tid,slug,season,episode,version,client):
#Set some basic headers for the request #Set some basic headers for the request
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", '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",
@@ -116,14 +116,14 @@ def get_season_episode_id(tid,slug,season,episode,version):
'x-inertia-version': version 'x-inertia-version': version
} }
#Get episode ID #Get episode ID
response = requests.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=headers) response = await client.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=headers, follow_redirects=True)
# Print the json got # Print the json got
json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', []) json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
for dict_episode in json_response: for dict_episode in json_response:
if dict_episode['number'] == episode: if dict_episode['number'] == episode:
return dict_episode['id'] return dict_episode['id']
def get_episode_link(episode_id,tid,version): async def get_episode_link(episode_id,tid,version,client):
#The parameters for the request #The parameters for the request
params = { params = {
'episode_id': episode_id, 'episode_id': episode_id,
@@ -131,7 +131,7 @@ def get_episode_link(episode_id,tid,version):
} }
#Let's try to get the link from iframe source #Let's try to get the link from iframe source
# Make a request to get iframe source # Make a request to get iframe source
response = requests.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params) response = await client.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params, follow_redirects=True)
# Parse response with BeautifulSoup to get iframe source # Parse response with BeautifulSoup to get iframe source
soup = BeautifulSoup(response.text, "lxml") soup = BeautifulSoup(response.text, "lxml")
@@ -146,7 +146,7 @@ def get_episode_link(episode_id,tid,version):
parsed_url = urlparse(iframe) parsed_url = urlparse(iframe)
query_params = parse_qs(parsed_url.query) query_params = parse_qs(parsed_url.query)
#Get real token and expires by looking at the page in the iframe, vixcloud/embed #Get real token and expires by looking at the page in the iframe, vixcloud/embed
resp = requests.get(iframe, headers = headers) resp = await client.get(iframe, headers = headers, follow_redirects=True)
soup= BeautifulSoup(resp.text, "lxml") soup= BeautifulSoup(resp.text, "lxml")
script = soup.find("body").find("script").text script = soup.find("body").find("script").text
token = re.search(r"'token':\s*'(\w+)'", script).group(1) token = re.search(r"'token':\s*'(\w+)'", script).group(1)
@@ -164,7 +164,7 @@ def get_episode_link(episode_id,tid,version):
return url,url720,quality return url,url720,quality
def streaming_community(imdb): async def streaming_community(imdb,client):
try: try:
general = is_movie(imdb) general = is_movie(imdb)
ismovie = general[0] ismovie = general[0]
@@ -177,7 +177,7 @@ def streaming_community(imdb):
if SC_FAST_SEARCH == "1": if SC_FAST_SEARCH == "1":
if "tt" in imdb: if "tt" in imdb:
#Get showname #Get showname
showname = get_info_imdb(imdb_id,ismovie,type) showname = await get_info_imdb(imdb_id,ismovie,type,client)
date = None date = None
else: else:
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled #I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
@@ -186,34 +186,32 @@ def streaming_community(imdb):
tmdba = imdb_id.replace("tmdb:","") tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type) showname = get_info_tmdb(tmdba,ismovie,type)
elif SC_FAST_SEARCH == "0": elif SC_FAST_SEARCH == "0":
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
showname,date = get_info_tmdb(tmdba,ismovie,type) showname,date = get_info_tmdb(tmdba,ismovie,type)
#HERE THE CASE IF IT IS A MOVIE #HERE THE CASE IF IT IS A MOVIE
else: else:
if "tt" in imdb: if "tt" in imdb:
#Get showname #Get showname
date = None date = None
showname = get_info_imdb(imdb_id,ismovie,type) showname = await get_info_imdb(imdb_id,ismovie,type,client)
else: else:
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
#else just equals them
date = None date = None
tmdba = imdb_id.replace("tmdb:","") tmdba = imdb_id.replace("tmdb:","")
showname = get_info_tmdb(tmdba,ismovie,type) showname = get_info_tmdb(tmdba,ismovie,type)
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}' query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
tid,slug = search(query,date,ismovie) tid,slug = await search(query,date,ismovie,client)
version = get_version() version = await get_version(client)
if ismovie == 1: if ismovie == 1:
#TID means temporaly ID #TID means temporaly ID
url,url720,quality = get_film(tid,version) url,url720,quality = await get_film(tid,version,client)
print(url) print(url)
return url,url720,quality return url,url720,quality
if ismovie == 0: if ismovie == 0:
#Uid = URL ID #Uid = URL ID
episode_id = get_season_episode_id(tid,slug,season,episode,version) episode_id = await get_season_episode_id(tid,slug,season,episode,version,client)
url,url720,quality = get_episode_link(episode_id,tid,version) url,url720,quality = await get_episode_link(episode_id,tid,version,client)
print(url) print(url)
return url,url720,quality return url,url720,quality
except Exception as e: except Exception as e:
+12 -12
View File
@@ -10,7 +10,7 @@ import config
import re import re
import json import json
SW_DOMAIN = config.SW_DOMAIN SW_DOMAIN = config.SW_DOMAIN
def search(showname,season,episode,date,ismovie): async def search(showname,season,episode,date,ismovie,client):
if ismovie == 1: if ismovie == 1:
query = f'https://www.streamingwatch.{SW_DOMAIN}/wp-admin/admin-ajax.php' query = f'https://www.streamingwatch.{SW_DOMAIN}/wp-admin/admin-ajax.php'
headers = { headers = {
@@ -38,12 +38,12 @@ def search(showname,season,episode,date,ismovie):
cookies = { cookies = {
'wordpress_test_cookie': 'WP%20Cookie%20check', 'wordpress_test_cookie': 'WP%20Cookie%20check',
} }
response = requests.post(query,cookies=cookies, headers=headers, data=data) response = await client.post(query,cookies=cookies, headers=headers, data=data)
soup = BeautifulSoup(response.content,'lxml') soup = BeautifulSoup(response.content,'lxml')
page_date = soup.find(id = 'search-cat-year').text.strip() page_date = soup.find(id = 'search-cat-year').text.strip()
if page_date == date: if page_date == date:
href = soup.find('a')['href'] href = soup.find('a')['href']
response = requests.get(href) response = await client.get(href, follow_redirects=True)
soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('iframe'))
iframe = soup.find('iframe') iframe = soup.find('iframe')
hdplayer = iframe.get('data-lazy-src') hdplayer = iframe.get('data-lazy-src')
@@ -51,11 +51,11 @@ def search(showname,season,episode,date,ismovie):
return hdplayer return hdplayer
elif ismovie == 0: 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 #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 = requests.get(f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/categories?search={showname}&_fields=id') id_response = await client.get(f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/categories?search={showname}&_fields=id', follow_redirects=True)
data = json.loads(id_response.text) data = json.loads(id_response.text)
category_id = data[0]['id'] category_id = data[0]['id']
query = f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/posts?categories={category_id}&per_page=100' query = f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/posts?categories={category_id}&per_page=100'
response = requests.get(query) response = await client.get(query, follow_redirects=True)
data_json = response.text data_json = response.text
data = json.loads(data_json) data = json.loads(data_json)
for entry in data: for entry in data:
@@ -67,13 +67,13 @@ def search(showname,season,episode,date,ismovie):
end = content.find('"', start) #end of url end = content.find('"', start) #end of url
hdplayer = content[start:end] hdplayer = content[start:end]
return hdplayer return hdplayer
def hls_url(hdplayer): async def hls_url(hdplayer,client):
response = requests.get(hdplayer) response = await client.get(hdplayer, follow_redirects=True)
match = re.search(r'sources:\s*\[\s*\{\s*file\s*:\s*"([^"]*)"', response.text) match = re.search(r'sources:\s*\[\s*\{\s*file\s*:\s*"([^"]*)"', response.text)
url = match.group(1) url = match.group(1)
print(url) print(url)
return url return url
def streamingwatch(imdb): async def streamingwatch(imdb,client):
try: try:
general = is_movie(imdb) general = is_movie(imdb)
ismovie = general[0] ismovie = general[0]
@@ -83,20 +83,20 @@ def streamingwatch(imdb):
season = int(general[2]) season = int(general[2])
episode = int(general[3]) episode = int(general[3])
if "tt" in imdb: if "tt" in imdb:
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else: else:
tmdba = imdb_id tmdba = imdb_id
else: else:
season = None season = None
episode = None episode = None
if "tt" in imdb: if "tt" in imdb:
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = await get_TMDb_id_from_IMDb_id(imdb_id,client)
else: else:
tmdba = imdb_id tmdba = imdb_id
showname,date = get_info_tmdb(tmdba,ismovie,type) showname,date = get_info_tmdb(tmdba,ismovie,type)
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
hdplayer = search(showname,season,episode,date,ismovie) hdplayer = await search(showname,season,episode,date,ismovie,client)
url = hls_url(hdplayer) url = await hls_url(hdplayer,client)
return url return url
except: except:
print("StreamingWatch Failed") print("StreamingWatch Failed")
+40 -40
View File
@@ -12,15 +12,15 @@ env_vars = load_env()
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
def search(showname,ismovie,date): async def search(showname,ismovie,date,client):
url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}' url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}'
response = requests.get(url) response = await client.get(url, follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml") soup = BeautifulSoup(response.text, "lxml")
if ismovie == 1: if ismovie == 1:
all_link = soup.select('#movies .col .list-media') all_link = soup.select('#movies .col .list-media')
for link in all_link: for link in all_link:
url = link['href'] url = link['href']
response = requests.get(url) response = client.get(url, follow_redirects=True)
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>' pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
found_date = re.search(pattern, response.text) found_date = re.search(pattern, response.text)
release_date = str(found_date.group(1)) release_date = str(found_date.group(1))
@@ -34,7 +34,7 @@ def search(showname,ismovie,date):
for link in all_link: for link in all_link:
base_url = link['href'] base_url = link['href']
url = f'{base_url}-1-season-1-episode' url = f'{base_url}-1-season-1-episode'
response = requests.get(url) response = await client.get(url, follow_redirects=True)
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>' pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
found_date = re.search(pattern, response.text) found_date = re.search(pattern, response.text)
release_date = str(found_date.group(1)) release_date = str(found_date.group(1))
@@ -46,9 +46,9 @@ def search(showname,ismovie,date):
#I try to get doodstream link inside this function so I do not have to get again the response #I try to get doodstream link inside this function so I do not have to get again the response
return url,embed_id return url,embed_id
def fast_search(showname,ismovie): async def fast_search(showname,ismovie,client):
url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}' url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}'
response = requests.get(url) response = await client.get(url, follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml") soup = BeautifulSoup(response.text, "lxml")
if ismovie == 1: if ismovie == 1:
first_link = soup.select_one('#movies .col .list-media') first_link = soup.select_one('#movies .col .list-media')
@@ -59,7 +59,7 @@ def fast_search(showname,ismovie):
first_link = soup.select_one('#series .col .list-media') first_link = soup.select_one('#series .col .list-media')
base_url = first_link['href'] base_url = first_link['href']
url = f'{base_url}-1-season-1-episode' url = f'{base_url}-1-season-1-episode'
response = requests.get(url) response = await client.get(url, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
a_tag = soup.find('a', class_='dropdown-toggle btn-service selected') a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
embed_id = a_tag['data-embed'] embed_id = a_tag['data-embed']
@@ -67,16 +67,16 @@ def fast_search(showname,ismovie):
def get_protect_link(id,url): async def get_protect_link(id,url,client):
#Get the link where the Iframe is located, which contains the doodstream url kind of. #Get the link where the Iframe is located, which contains the doodstream url kind of.
response = requests.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}") response = await client.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}", follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src'] protect_link = soup.iframe['src']
if "protect" in protect_link: if "protect" in protect_link:
return protect_link return protect_link
else: else:
#DO this in case the movie has a 3D version etc #DO this in case the movie has a 3D version etc
response = requests.get(url) response = await client.get(url, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
a_tag = soup.find('a', class_='dropdown-toggle btn-service selected') a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
embed_id = a_tag['data-embed'] embed_id = a_tag['data-embed']
@@ -89,9 +89,9 @@ def get_protect_link(id,url):
'id': embed_id 'id': embed_id
} }
ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed" ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed"
response = requests.post(ajax_url, headers=headers, data=data) response = await client.post(ajax_url, headers=headers, data=data)
hdplayer = response.text[43:-27] hdplayer = response.text[43:-27]
response = requests.get(hdplayer) response = await client.get(hdplayer, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
links_dict = {} links_dict = {}
li_tags = soup.select('ul.nav.navbar-nav li.dropdown') li_tags = soup.select('ul.nav.navbar-nav li.dropdown')
@@ -103,7 +103,7 @@ def get_protect_link(id,url):
if title == "1" or "Tantifilm" in title: if title == "1" or "Tantifilm" in title:
continue # Get the text of the <a> tag continue # Get the text of the <a> tag
href = a_tag['href'] href = a_tag['href']
response = requests.get(href) response = await client.get(href, follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src'] protect_link = soup.iframe['src']
if "protect" in protect_link: if "protect" in protect_link:
@@ -113,7 +113,7 @@ def get_protect_link(id,url):
# Get the value of the href attribute # Get the value of the href attribute
def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode): async def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode,client):
headers = { 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', '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 'Referer': url
@@ -123,21 +123,21 @@ def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode):
'id': embed_id 'id': embed_id
} }
ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed" ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed"
response = requests.post(ajax_url, headers=headers, data=data) response = await client.post(ajax_url, headers=headers, data=data)
nuovo_indirizzo = response.text[43:-27] nuovo_indirizzo = response.text[43:-27]
response = requests.get(nuovo_indirizzo) response = await client.get(nuovo_indirizzo, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
#Get season #Get season
season = season - 1 season = season - 1
li_tags = soup.select('ul.nav.navbar-nav > li.dropdown') li_tags = soup.select('ul.nav.navbar-nav > li.dropdown')
if len(li_tags) != 1: if len(li_tags) != 1:
link = li_tags[season].find('a')['href'] link = li_tags[season].find('a')['href']
response = requests.get(link) response = await client.get(link, follow_redirects=True)
soup = BeautifulSoup(response.text, 'lxml') soup = BeautifulSoup(response.text, 'lxml')
option_tag = soup.select(f'select[name="ep_select"] > option:nth-of-type({episode})')[0] option_tag = soup.select(f'select[name="ep_select"] > option:nth-of-type({episode})')[0]
link = option_tag['value'] link = option_tag['value']
#Let's find protect link now #Let's find protect link now
response = requests.get(link) response = await client.get(link, follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src'] protect_link = soup.iframe['src']
return protect_link return protect_link
@@ -147,13 +147,13 @@ def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode):
option_tag = soup.select('select.dynamic_select > option')[episode] option_tag = soup.select('select.dynamic_select > option')[episode]
link = option_tag['value'] link = option_tag['value']
#Let's find protect link now #Let's find protect link now
response = requests.get(link) response = await client.get(link, follow_redirects=True)
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe')) soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
protect_link = soup.iframe['src'] protect_link = soup.iframe['src']
return protect_link return protect_link
def true_url(protect_link): async def true_url(protect_link,client):
print(protect_link) print(protect_link)
# Define headers # Define headers
headers = { headers = {
@@ -166,9 +166,9 @@ def true_url(protect_link):
"http": proxy, "http": proxy,
"https": proxy "https": proxy
} }
response = requests.get(protect_link, proxies=proxies) response = await client.get(protect_link, proxies=proxies, follow_redirects=True)
else: else:
response = requests.get(protect_link) response = await client.get(protect_link, follow_redirects=True)
link = response.url link = response.url
@@ -187,7 +187,7 @@ def true_url(protect_link):
# Create real link (match[0] includes all matched elements) # Create real link (match[0] includes all matched elements)
url =f'https://d000d.com{match[1]}' url =f'https://d000d.com{match[1]}'
print("MD5: ", url) print("MD5: ", url)
rebobo = requests.get(url, headers=headers) rebobo = await client.get(url, headers=headers, follow_redirects=True)
real_url = f'{rebobo.text}123456789{match[2]}{real_time}' real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
print(real_url) print(real_url)
return real_url return real_url
@@ -201,7 +201,7 @@ def true_url(protect_link):
#Get temporaly ID #Get temporaly ID
def tantifilm(imdb): async def tantifilm(imdb,client):
urls = None urls = None
try: try:
general = is_movie(imdb) general = is_movie(imdb)
@@ -213,44 +213,44 @@ def tantifilm(imdb):
episode = int(general[3]) episode = int(general[3])
if "tt" in imdb: if "tt" in imdb:
if TF_FAST_SEARCH == "0": if TF_FAST_SEARCH == "0":
showname,date = get_info_imdb(imdb_id,ismovie,type) showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
url,embed_id = search(showname,ismovie,date) url,embed_id = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1": elif TF_FAST_SEARCH == "1":
showname = get_info_imdb(imdb_id,ismovie,type) showname = await get_info_imdb(imdb_id,ismovie,type,client)
url,embed_id = fast_search(showname,ismovie) url,embed_id = await fast_search(showname,ismovie,client)
else: else:
#else just equals them #else just equals them
tmdba = imdb_id.replace("tmdb:","") tmdba = imdb_id.replace("tmdb:","")
if TF_FAST_SEARCH == "0": if TF_FAST_SEARCH == "0":
showname,date = get_info_tmdb(tmdba,ismovie,type) showname,date = get_info_tmdb(tmdba,ismovie,type)
url,embed_id = search(showname,ismovie,date) url,embed_id = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1": elif TF_FAST_SEARCH == "1":
showname= get_info_tmdb(tmdba,ismovie,type) showname= get_info_tmdb(tmdba,ismovie,type)
url,embed_id = fast_search(showname,ismovie) url,embed_id = await fast_search(showname,ismovie,client)
protect_link = get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode) protect_link = await get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode,client)
url = true_url(protect_link) url = await true_url(protect_link,client)
return url return url
elif ismovie == 1: elif ismovie == 1:
if "tt" in imdb: if "tt" in imdb:
#Get showname #Get showname
if TF_FAST_SEARCH == "0": if TF_FAST_SEARCH == "0":
showname,date = get_info_imdb(imdb_id,ismovie,type) showname,date = await get_info_imdb(imdb_id,ismovie,type,client)
tid,url = search(showname,ismovie,date) tid,url = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1": elif TF_FAST_SEARCH == "1":
showname = get_info_imdb(imdb_id,ismovie,type) showname = await get_info_imdb(imdb_id,ismovie,type,client)
date = None date = None
tid,url = fast_search(showname,ismovie) tid,url = await fast_search(showname,ismovie,client)
else: else:
#else just equals themtantifilm("tt2096673") #else just equals themtantifilm("tt2096673")
if TF_FAST_SEARCH == "0": if TF_FAST_SEARCH == "0":
showname,date = get_info_tmdb(imdb,ismovie,type) showname,date = get_info_tmdb(imdb,ismovie,type)
tid,url = search(showname,ismovie,date) tid,url = await search(showname,ismovie,date,client)
elif TF_FAST_SEARCH == "1": elif TF_FAST_SEARCH == "1":
showname = get_info_tmdb(imdb,ismovie,type) showname = get_info_tmdb(imdb,ismovie,type)
tid,url = fast_search(showname,ismovie) tid,url = await fast_search(showname,ismovie,client)
protect_link = get_protect_link(tid,url) protect_link = await get_protect_link(tid,url,client)
if not isinstance(protect_link, str): if not isinstance(protect_link, str):
urls = protect_link urls = protect_link
if urls: if urls:
@@ -258,7 +258,7 @@ def tantifilm(imdb):
else: else:
print("Tantifilm Error v2") print("Tantifilm Error v2")
else: else:
url = true_url(protect_link) url = await true_url(protect_link,client)
if url: if url:
return url return url