SC fix, AW Fix, CB01 Fix
This commit is contained in:
+34
-8
@@ -5,6 +5,31 @@ import json
|
||||
from Src.Utilities.info import get_info_kitsu
|
||||
import Src.Utilities.config as config
|
||||
import re
|
||||
from fake_headers import Headers
|
||||
random_headers = Headers()
|
||||
proxies = {}
|
||||
from Src.Utilities.loadenv import load_env
|
||||
env_vars = load_env()
|
||||
AW_PROXY = config.AW_PROXY
|
||||
AW_ForwardProxy = config.AW_ForwardProxy
|
||||
if AW_PROXY == "1":
|
||||
import random
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies = {}
|
||||
else:
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if AW_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy = ""
|
||||
|
||||
|
||||
AW_DOMAIN = config.AW_DOMAIN
|
||||
months = {
|
||||
"Gennaio": "January", "Febbraio": "February", "Marzo": "March",
|
||||
@@ -21,14 +46,14 @@ showname_replace = {
|
||||
}
|
||||
|
||||
async def get_mp4(anime_url,ismovie,episode,client):
|
||||
response = await client.get(anime_url,allow_redirects=True, impersonate = "chrome120")
|
||||
response = await client.get(ForwardProxy + anime_url,allow_redirects=True, impersonate = "chrome124",proxies=proxies)
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
if ismovie == 0:
|
||||
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")
|
||||
response = await client.get(ForwardProxy + episode_page,allow_redirects=True, impersonate = "chrome124", proxies=proxies)
|
||||
soup = BeautifulSoup(response.text,'lxml')
|
||||
|
||||
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
||||
@@ -93,7 +118,7 @@ async def old_search(showname,date,ismovie,episode,client):
|
||||
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")
|
||||
response = await client.post(ForwardProxy + f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies)
|
||||
data = json.loads(response.text)
|
||||
for anime in data["animes"]:
|
||||
release_date = anime["release"]
|
||||
@@ -112,13 +137,15 @@ async def old_search(showname,date,ismovie,episode,client):
|
||||
|
||||
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")
|
||||
headers = random_headers.generate()
|
||||
|
||||
response = await client.get(ForwardProxy + f'https://www.animeworld.so/filter?year={search_year}&sort=2&keyword={showname}',allow_redirects=True, impersonate = "chrome124", headers = headers, proxies = proxies)
|
||||
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")
|
||||
response = await client.get(ForwardProxy + anime_info_url,allow_redirects=True, impersonate = "chrome124", proxies = proxies)
|
||||
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()
|
||||
@@ -154,7 +181,7 @@ async def animeworld(id,client):
|
||||
except:
|
||||
print("Animeworld failed")
|
||||
return None
|
||||
'''
|
||||
|
||||
async def test_animeworld():
|
||||
async with AsyncSession() as client:
|
||||
# Replace with actual id, for example 'anime_id:episode' format
|
||||
@@ -165,5 +192,4 @@ async def test_animeworld():
|
||||
if __name__ == "__main__":
|
||||
from curl_cffi.requests import AsyncSession
|
||||
import asyncio
|
||||
asyncio.run(test_animeworld())
|
||||
'''
|
||||
asyncio.run(test_animeworld())
|
||||
+60
-45
@@ -7,9 +7,51 @@ import Src.Utilities.config as config
|
||||
from Src.Utilities.loadenv import load_env
|
||||
CB_DOMAIN = config.CB_DOMAIN
|
||||
CB_PROXY = config.CB_PROXY
|
||||
if CB_PROXY == "1":
|
||||
env_vars = load_env()
|
||||
MX_PROXY = config.MX_PROXY
|
||||
proxies = {}
|
||||
proxies2 = {}
|
||||
env_vars = load_env()
|
||||
import random
|
||||
import json
|
||||
if MX_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies2 = {}
|
||||
else:
|
||||
proxies2 = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if CB_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies = {}
|
||||
else:
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if MX_PROXY == "1":
|
||||
proxies2 = proxy
|
||||
|
||||
CB_ForwardProxy = config.CB_ForwardProxy
|
||||
MX_ForwardProxy = config.MX_ForwardProxy
|
||||
if CB_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
ForwardProxy2 = ForwardProxy
|
||||
if MX_ForwardProxy == "1":
|
||||
ForwardProxy2 = ForwardProxy
|
||||
elif MX_ForwardProxy == "1":
|
||||
ForwardProxy2 = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy2 = ""
|
||||
ForwardProxy = ""
|
||||
|
||||
|
||||
fake_headers = Headers()
|
||||
|
||||
async def get_stayonline(link,client):
|
||||
@@ -19,7 +61,7 @@ async def get_stayonline(link,client):
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
}
|
||||
data = {'id': link.split("/")[-2], 'ref': ''}
|
||||
response = await client.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data)
|
||||
response = await client.post(ForwardProxy2 + 'https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data, proxies2 = proxies2)
|
||||
real_url = response.json()['data']['value']
|
||||
return real_url
|
||||
|
||||
@@ -27,23 +69,8 @@ async def get_stayonline(link,client):
|
||||
async def get_uprot(link,client):
|
||||
if "msf" in link:
|
||||
link = link.replace("msf","mse")
|
||||
if CB_PROXY == "1":
|
||||
import json
|
||||
import random
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == " ":
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
else:
|
||||
proxies = {}
|
||||
else:
|
||||
proxies = {}
|
||||
|
||||
headers = fake_headers.generate()
|
||||
response = await client.get(link, headers=headers, allow_redirects=True, timeout=10, proxies=proxies, impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy2 + link, headers=headers, allow_redirects=True, timeout=10, proxies=proxies2, impersonate = "chrome124")
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
maxstream_url = soup.find("a")
|
||||
maxstream_url = maxstream_url.get("href")
|
||||
@@ -75,21 +102,9 @@ async def get_true_link_mixdrop(real_link,client,MFP):
|
||||
print(e)
|
||||
return None
|
||||
async def get_true_link_maxstream(maxstream_url,client):
|
||||
headers = fake_headers.generate()
|
||||
if CB_PROXY == "1":
|
||||
import json
|
||||
import random
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == " ":
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
else:
|
||||
proxies = {}
|
||||
headers = fake_headers.generate()
|
||||
# Send a GET request to the Maxstream URL
|
||||
response = await client.get(maxstream_url, headers=headers, allow_redirects=True, timeout=10,proxies = proxies, impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy2 + maxstream_url, headers=headers, allow_redirects=True, timeout=10,proxies = proxies2, impersonate = "chrome124")
|
||||
[s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2)
|
||||
terms = s2.split("|")
|
||||
urlset_index = terms.index('urlset')
|
||||
@@ -124,11 +139,11 @@ async def get_true_link_maxstream(maxstream_url,client):
|
||||
|
||||
async def search_movie(showname,date,client):
|
||||
try:
|
||||
showname = showname.replace(" ","+")
|
||||
showname = showname.replace(" ","+").replace("ò","o").replace("è","e").replace("à","a").replace("ù","u").replace("ì","i")
|
||||
headers = fake_headers.generate()
|
||||
headers['Referer'] = f'https://cb01new.{CB_DOMAIN}/'
|
||||
query = f'https://cb01new.{CB_DOMAIN}/?s={showname}'
|
||||
response = await client.get(query,headers=headers, impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy + query,headers=headers, impersonate = "chrome124", proxies = proxies)
|
||||
if response.status_code != 200:
|
||||
print(f"CB01 Failed to fetch search results: {response.status_code}")
|
||||
soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('div', class_='card-content'))
|
||||
@@ -157,7 +172,7 @@ async def search_series(showname,date,client):
|
||||
headers = fake_headers.generate()
|
||||
headers['Referer'] = f'https://cb01new.{CB_DOMAIN}/serietv/'
|
||||
query = f'https://cb01new.{CB_DOMAIN}/serietv/?s={showname}'
|
||||
response = await client.get(query,headers=headers,impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy + query,headers=headers,impersonate = "chrome124", proxies = proxies)
|
||||
if response.status_code != 200:
|
||||
print(f"CB01 Failed to fetch search results: {response.status_code}")
|
||||
soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('div', class_='card-content'))
|
||||
@@ -183,7 +198,7 @@ async def search_series(showname,date,client):
|
||||
|
||||
async def movie_redirect_url(link,client,MFP):
|
||||
headers = fake_headers.generate()
|
||||
response = await client.get(link, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124", proxies = proxies)
|
||||
# Extract the redirect URL from the HTML
|
||||
soup = BeautifulSoup(response.text, "lxml",parse_only=SoupStrainer('div'))
|
||||
redirect_url = soup.find("div", id="iframen2").get("data-src")
|
||||
@@ -192,11 +207,11 @@ async def movie_redirect_url(link,client,MFP):
|
||||
mixdrop_real_link = await get_stayonline(redirect_url,client)
|
||||
final_url = await get_true_link_mixdrop(mixdrop_real_link,client,MFP)
|
||||
return final_url
|
||||
except Exception as e:
|
||||
except Exception as e:
|
||||
redirect_url = soup.find("div", id="iframen1").get("data-src")
|
||||
if "stayonline" in maxstream_link:
|
||||
maxstream_link =await get_stayonline(maxstream_link,client)
|
||||
maxstream_real_link = await get_uprot(maxstream_link,client)
|
||||
if "stayonline" in redirect_url:
|
||||
redirect_url =await get_stayonline(redirect_url,client)
|
||||
maxstream_real_link = await get_uprot(redirect_url,client)
|
||||
final_url = await get_true_link_maxstream(maxstream_real_link,client)
|
||||
return(final_url)
|
||||
|
||||
@@ -205,7 +220,7 @@ async def series_redirect_url(link,season,episode,client,MFP):
|
||||
if len(episode) == 1:
|
||||
episode = f'0{episode}'
|
||||
headers = fake_headers.generate()
|
||||
response = await client.get(link, headers=headers, allow_redirects=True, timeout=10,impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True, timeout=10,impersonate = "chrome124", proxies = proxies)
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
seasons_text = soup.find_all('div', class_='sp-head')
|
||||
for season_text in seasons_text:
|
||||
@@ -218,7 +233,7 @@ async def series_redirect_url(link,season,episode,client,MFP):
|
||||
sp_body = season_text.find_next('div', class_='sp-body')
|
||||
link_tag = sp_body.find('a')
|
||||
uprot_long = link_tag.get('href')
|
||||
response = await client.get(uprot_long, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124")
|
||||
response = await client.get(ForwardProxy + uprot_long, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124", proxies = proxies)
|
||||
season = "01"
|
||||
episode = "04"
|
||||
pattern1 = rf"(?i)\S*?\.{season}x{episode}\S*?\.mkv.*?href=['\"](.*?)['\"]"
|
||||
@@ -301,8 +316,8 @@ 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 = "tt14948432" # This is an example ID format
|
||||
MFP = "1"
|
||||
test_id = "tt0045247" # This is an example ID format
|
||||
MFP = "0"
|
||||
results = await cb01(test_id, client,MFP)
|
||||
print(results)
|
||||
|
||||
|
||||
@@ -9,11 +9,24 @@ from urllib.parse import urlparse, parse_qs
|
||||
from fake_headers import Headers
|
||||
from Src.Utilities.loadenv import load_env
|
||||
import urllib.parse
|
||||
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"
|
||||
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
|
||||
|
||||
env_vars = load_env()
|
||||
SC_PROXY = config.SC_PROXY
|
||||
VX_PROXY = config.VX_PROXY
|
||||
proxies = {}
|
||||
proxies2 = {}
|
||||
if VX_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies2 = {}
|
||||
else:
|
||||
proxies2 = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if SC_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
@@ -25,11 +38,20 @@ if SC_PROXY == "1":
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if VX_PROXY == "1":
|
||||
proxies2 = proxy
|
||||
|
||||
SC_ForwardProxy = config.SC_ForwardProxy
|
||||
VX_ForwardProxy = config.VX_ForwardProxy
|
||||
if SC_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy = ""
|
||||
|
||||
if VX_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy = ""
|
||||
#Get domain
|
||||
SC_DOMAIN = config.SC_DOMAIN
|
||||
Public_Instance = config.Public_Instance
|
||||
@@ -126,7 +148,7 @@ async def get_film(tid,version,client):
|
||||
random_headers['User-Agent'] = User_Agent
|
||||
random_headers['user-agent'] = User_Agent
|
||||
#Get real token and expires by looking at the page in the iframe, vixcloud/embed
|
||||
resp = await client.get(ForwardProxy + iframe, headers = random_headers, allow_redirects=True,impersonate= "chrome124", proxies = proxies)
|
||||
resp = await client.get(ForwardProxy + iframe, headers = random_headers, allow_redirects=True,impersonate= "chrome124", proxies = proxies2)
|
||||
soup= BeautifulSoup(resp.text, "lxml")
|
||||
script = soup.find("body").find("script").text
|
||||
token = re.search(r"'token':\s*'(\w+)'", script).group(1)
|
||||
@@ -204,7 +226,7 @@ async def get_episode_link(episode_id,tid,version,client):
|
||||
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(ForwardProxy + iframe, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies)
|
||||
resp = await client.get(ForwardProxy + iframe, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies2)
|
||||
soup= BeautifulSoup(resp.text, "lxml")
|
||||
script = soup.find("body").find("script").text
|
||||
token = re.search(r"'token':\s*'(\w+)'", script).group(1)
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ async def get_stream_link(id,site,MFP_CREDENTIALS,client):
|
||||
print("No .m3u8 URL found.")
|
||||
stream_url = f"https://{domain}/lb/" + webru_dlhd[id] + "/index.m3u8"
|
||||
elif site == "vary":
|
||||
response = await client.get(f"https://www.tanti.{TF_DOMAIN}/tv-channel/sky-cinema-action-2", impersonate = "chrome124", headers = headers)
|
||||
response = await client.get(f"https://www.tanti.{TF_DOMAIN}/tv-channel/sky-cinema-action-2", impersonate = "chrome124", headers = headers, timeout = 10)
|
||||
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('iframe'))
|
||||
iframe = soup.find('iframe', class_='embed-responsive-item')
|
||||
real_link = iframe.get('src')
|
||||
|
||||
@@ -37,11 +37,18 @@ TF_ForwardProxy = SITE['Tantifilm']["TF_ForwardProxy"]
|
||||
SC_ForwardProxy = SITE['StreamingCommunity']["SC_ForwardProxy"]
|
||||
GS_ForwardProxy = SITE['Guardaserie']["GS_ForwardProxy"]
|
||||
GH_ForwardProxy = SITE['GuardaHD']["GH_ForwardProxy"]
|
||||
VX_ForwardProxy = SITE['StreamingCommunity']["VX_ForwardProxy"]
|
||||
AW_ForwardProxy = SITE['AnimeWorld']["AW_ForwardProxy"]
|
||||
MX_ForwardProxy = SITE['CB01']["MX_ForwardProxy"]
|
||||
CB_ForwardProxy = SITE['CB01']["CB_ForwardProxy"]
|
||||
GS_PROXY = SITE['Guardaserie']["GS_PROXY"]
|
||||
GH_PROXY = SITE['GuardaHD']["GH_PROXY"]
|
||||
TF_PROXY = SITE['Tantifilm']["TF_PROXY"]
|
||||
CB_PROXY = SITE['CB01']["CB_PROXY"]
|
||||
SC_PROXY = SITE['StreamingCommunity']["SC_PROXY"]
|
||||
VX_PROXY = SITE['StreamingCommunity']["VX_PROXY"]
|
||||
AW_PROXY = SITE['AnimeWorld']["AW_PROXY"]
|
||||
MX_PROXY = SITE['CB01']["MX_PROXY"]
|
||||
ips4_device_key = SITE['DDLStream']['cookies']["ips4_device_key"]
|
||||
ips4_IPSSessionFront = SITE['DDLStream']['cookies']["ips4_IPSSessionFront"]
|
||||
ips4_member_id = SITE['DDLStream']['cookies']["ips4_member_id"]
|
||||
|
||||
+55
-3
@@ -1,13 +1,58 @@
|
||||
from urllib.parse import urlparse, parse_qs,unquote,quote
|
||||
from fastapi import APIRouter, HTTPException, Response, Request
|
||||
from curl_cffi.requests import AsyncSession
|
||||
import Src.Utilities.config as config
|
||||
from Src.Utilities.loadenv import load_env
|
||||
env_vars = load_env()
|
||||
SC_PROXY = config.SC_PROXY
|
||||
VX_PROXY = config.VX_PROXY
|
||||
import json
|
||||
import random
|
||||
proxies = {}
|
||||
proxies2 = {}
|
||||
if VX_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies2 = {}
|
||||
else:
|
||||
proxies2 = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if SC_PROXY == "1":
|
||||
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
|
||||
proxy_list = json.loads(PROXY_CREDENTIALS)
|
||||
proxy = random.choice(proxy_list)
|
||||
if proxy == "":
|
||||
proxies = {}
|
||||
else:
|
||||
proxies = {
|
||||
"http": proxy,
|
||||
"https": proxy
|
||||
}
|
||||
if VX_PROXY == "1":
|
||||
proxies2 = proxy
|
||||
SC_ForwardProxy = config.SC_ForwardProxy
|
||||
VX_ForwardProxy = config.VX_ForwardProxy
|
||||
if SC_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy = ""
|
||||
|
||||
if VX_ForwardProxy == "1":
|
||||
ForwardProxy = env_vars.get('ForwardProxy')
|
||||
else:
|
||||
ForwardProxy = ""
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
User_Agent= "Mozilla/5.0 (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"
|
||||
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
|
||||
async def fetch_m3u8(url):
|
||||
"""Fetch the M3U8 file from the URL and store it in memory."""
|
||||
async with AsyncSession() as client:
|
||||
response = await client.get(url,headers = {"User-Agent": User_Agent, "user-agent": User_Agent})
|
||||
response = await client.get(ForwardProxy + url,headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
|
||||
response.raise_for_status() # Raise an error for bad responses
|
||||
return response.text
|
||||
|
||||
@@ -36,6 +81,7 @@ async def clone2_m3u8(d:str,token:str,expires:str,h:str = None, b:str = None, re
|
||||
scheme = forwarded_proto if forwarded_proto else request.url.scheme
|
||||
instance_url = f"{scheme}://{request.url.netloc}"
|
||||
m3u8_content = await fetch_m3u8(m3u8)
|
||||
print(m3u8_content)
|
||||
modified_playlist = m3u8_content.replace("https://vixcloud.co/playlist/", f"{instance_url}/clony/")
|
||||
|
||||
return Response(content=modified_playlist, media_type='application/vnd.apple.mpegurl')
|
||||
@@ -47,13 +93,19 @@ async def clone2_m3u8(d:str,token:str,expires:str,h:str = None, b:str = None, re
|
||||
async def clony_m3u8(segment: str, request: Request):
|
||||
base_url = "https://vixcloud.co/playlist/"
|
||||
full_url = f"{base_url}{segment}?{request.query_params}"
|
||||
if "rendition=1080p" in full_url or "type=subtitle" in full_url:
|
||||
print(full_url)
|
||||
raise HTTPException(status_code=404, detail="Requested variant not available.")
|
||||
m3u8_content = await fetch_m3u8(full_url)
|
||||
if "sc-b1" in m3u8_content:
|
||||
import re
|
||||
m3u8_content = re.sub(r"https://sc-b1-([0-2][0-9]|30).scws-content.net", "https://sc-u9-01.scws-content.net", m3u8_content)
|
||||
return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
|
||||
|
||||
@router.api_route('/storage/enc.key')
|
||||
async def get_key():
|
||||
async with AsyncSession(timeout = 20) as client:
|
||||
response = await client.get('https://vixcloud.co/storage/enc.key', headers = {"User-Agent": User_Agent, "user-agent": User_Agent})
|
||||
response = await client.get(ForwardProxy + 'https://vixcloud.co/storage/enc.key', headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
|
||||
|
||||
response_headers = {
|
||||
'date': response.headers['date'],
|
||||
|
||||
Reference in New Issue
Block a user