Add auto-update domains + some bug fix

This commit is contained in:
UrloMythus
2026-02-09 16:49:20 +01:00 Unverified
parent bafd7e2d07
commit cef29094dc
8 changed files with 113 additions and 12 deletions
+3 -3
View File
@@ -172,14 +172,14 @@ async def series_search_streams(text,search_text,response_text,headers,season,ep
if match: if match:
streams = await get_maxstream(match.group(2),streams,client) streams = await get_maxstream(match.group(2),streams,client)
else: else:
match = re.search(rf'{season}&#215;{episode}\s*&#8211;\s*<a[^>]*href="[^"]*"[^>]*>[^<]*</a>\s&#8211; <a[^>]*href="[^"]*',response_text) match = re.search(rf'{season}&#215;{episode}\s*&#8211;\s*<a[^>]*href="[^"]*"[^>]*>[^<]*</a>\s&#8211; <a[^>]*href="[^"]*.*</a>',response_text)
if match: if match:
links = match.group(0) links = match.group(0)
soup = BeautifulSoup(links,'lxml',parse_only=SoupStrainer('a')) soup = BeautifulSoup(links,'lxml',parse_only=SoupStrainer('a'))
host_links = soup.find_all('a') host_links = soup.find_all('a')
mixdrop_real_link = await get_stayonline(host_links[1]['href'],client) mixdrop_real_link = await get_stayonline(host_links[1]['href'],client)
status = False status = False
#streams,status = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"") streams,status = await mixdrop(mixdrop_real_link,client,MFP,MFP_CREDENTIALS,streams,"CB01",proxies,ForwardProxy,"")
if status == False: if status == False:
streams = await get_maxstream(host_links[0]['href'],streams,client) streams = await get_maxstream(host_links[0]['href'],streams,client)
return streams return streams
@@ -255,7 +255,7 @@ async def cb01(streams,id,MFP,MFP_CREDENTIALS,client):
async def test_animeworld(): async def test_animeworld():
from curl_cffi.requests import AsyncSession from curl_cffi.requests import AsyncSession
async with AsyncSession() as client: async with AsyncSession() as client:
test_id = "tt0158552:1:2" # This is an example ID format test_id = "tt12324366:2:2" # This is an example ID format
MFP = "0" MFP = "0"
results = await cb01({'streams': []},test_id,MFP,['test','test'],client) results = await cb01({'streams': []},test_id,MFP,['test','test'],client)
print(results) print(results)
+15 -2
View File
@@ -9,6 +9,7 @@ from Src.API.extractors.uqload import uqload
from Src.API.extractors.dropload import dropload from Src.API.extractors.dropload import dropload
import logging import logging
from Src.Utilities.config import setup_logging from Src.Utilities.config import setup_logging
from Src.Utilities.update_config import update_site
import json import json
import random import random
level = config.LEVEL level = config.LEVEL
@@ -36,7 +37,15 @@ if GF_ForwardProxy == "1":
else: else:
ForwardProxy = "" ForwardProxy = ""
async def new_domain(url,data,headers,proxies,ForwardProxy,client):
url = url.split('/wp-admin')[0]
headers['Origin'] = url
headers['Referer'] = f'{url}/'
response = await client.post(ForwardProxy + f'{url}/wp-admin/admin-ajax.php', data = data, headers = headers, proxies = proxies)
if response.status_code != 200:
logger.warning(f"Guardaflix Failed to fetch search results: {response.status_code}")
result = update_site(client,['guardaplay','Guardaflix'])
return response.text
async def get_player(page_link,MFP, MFP_CREDENTIALS,client, headers,streams): async def get_player(page_link,MFP, MFP_CREDENTIALS,client, headers,streams):
response = await client.get(ForwardProxy + page_link, headers= headers, proxies = proxies) response = await client.get(ForwardProxy + page_link, headers= headers, proxies = proxies)
@@ -63,9 +72,13 @@ async def search(showname,date,MFP,MFP_CREDENTIALS,client,streams):
'term': showname, 'term': showname,
} }
response = await client.post(ForwardProxy + f'{GF_DOMAIN}/wp-admin/admin-ajax.php', headers=headers, data=data, proxies = proxies) response = await client.post(ForwardProxy + f'{GF_DOMAIN}/wp-admin/admin-ajax.php', headers=headers, data=data, proxies = proxies)
text = response.text
if response.status_code != 200: if response.status_code != 200:
if response.status_code == 400:
text = await new_domain(response.url,data,headers,proxies,ForwardProxy,client)
if len(text) < 10:
logger.warning(f"Guardaflix Failed to fetch search results: {response.status_code}") logger.warning(f"Guardaflix Failed to fetch search results: {response.status_code}")
soup = BeautifulSoup(response.text,'lxml', parse_only= SoupStrainer('a')) soup = BeautifulSoup(text,'lxml', parse_only= SoupStrainer('a'))
a_tags = soup.find_all('a') a_tags = soup.find_all('a')
for a in a_tags: for a in a_tags:
href = a['href'] href = a['href']
+1 -1
View File
@@ -117,7 +117,7 @@ async def test_script():
from curl_cffi.requests import AsyncSession from curl_cffi.requests import AsyncSession
async with AsyncSession() as client: async with AsyncSession() as client:
# Replace with actual id, for example 'anime_id:episode' format # Replace with actual id, for example 'anime_id:episode' format
test_id = "tt10919420:1:1" # This is an example ID format tt0460649 test_id = "tt12324366:2:2" # This is an example ID format tt0460649
results = await guardaserie({'streams': []},test_id, client) results = await guardaserie({'streams': []},test_id, client)
print(results) print(results)
+16 -2
View File
@@ -10,6 +10,7 @@ from Src.API.extractors.loadm import loadm
from Src.API.extractors.dropload import dropload from Src.API.extractors.dropload import dropload
import logging import logging
from Src.Utilities.config import setup_logging from Src.Utilities.config import setup_logging
from Src.Utilities.update_config import update_site
level = config.LEVEL level = config.LEVEL
import json import json
import random import random
@@ -32,12 +33,21 @@ if GO_PROXY == "1":
"https": proxy "https": proxy
} }
GO_ForwardProxy = config.GO_ForwardProxy GO_ForwardProxy = config.GO_ForwardProxy
if GO_ForwardProxy == "1": if GO_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy') ForwardProxy = env_vars.get('ForwardProxy')
else: else:
ForwardProxy = "" ForwardProxy = ""
async def new_domain(url,data,headers,proxies,ForwardProxy,client):
url = url.split('/wp-admin')[0]
headers['Origin'] = url
headers['Referer'] = f'{url}/'
response = await client.post(ForwardProxy + f'{url}/wp-admin/admin-ajax.php', data = data, headers = headers, proxies = proxies)
if response.status_code != 200:
logger.warning(f"Guardoserie Failed to fetch search results: {response.status_code}")
result = await update_site(client,['guardoserie_2','Guardoserie'])
return response.text
async def get_player(page_link,MFP,MFP_CREDENTIALS,client, headers, streams): async def get_player(page_link,MFP,MFP_CREDENTIALS,client, headers, streams):
response = await client.get(ForwardProxy + page_link, headers= headers, proxies = proxies) response = await client.get(ForwardProxy + page_link, headers= headers, proxies = proxies)
@@ -63,9 +73,13 @@ async def search(showname,date,season,episode,MFP, MFP_CREDENTIALS,ismovie,clien
showname = quote(showname) showname = quote(showname)
data = f's={showname}&action=searchwp_live_search&swpengine=default&swpquery={showname}' data = f's={showname}&action=searchwp_live_search&swpengine=default&swpquery={showname}'
response = await client.post(ForwardProxy + f'{GO_DOMAIN}/wp-admin/admin-ajax.php', data = data, headers = headers, proxies = proxies) response = await client.post(ForwardProxy + f'{GO_DOMAIN}/wp-admin/admin-ajax.php', data = data, headers = headers, proxies = proxies)
text = response.text
if response.status_code != 200: if response.status_code != 200:
if response.status_code == 400:
text = await new_domain(response.url,data,headers,proxies,ForwardProxy,client)
if len(text) < 10:
logger.warning(f"Guardoserie Failed to fetch search results: {response.status_code}") logger.warning(f"Guardoserie Failed to fetch search results: {response.status_code}")
soup = BeautifulSoup(response.text,'lxml', parse_only= SoupStrainer('a', class_='ss-title')) soup = BeautifulSoup(text,'lxml', parse_only= SoupStrainer('a', class_='ss-title'))
a_tags = soup.find_all('a') a_tags = soup.find_all('a')
for a in a_tags: for a in a_tags:
href = a['href'] href = a['href']
+1 -1
View File
@@ -114,7 +114,7 @@ async def toonitalia(streams,id,client,MFP,MFP_CREDENTIALS):
async def test_toonitalia(): async def test_toonitalia():
from curl_cffi.requests import AsyncSession from curl_cffi.requests import AsyncSession
async with AsyncSession() as client: async with AsyncSession() as client:
results = await toonitalia({'streams': []},"tt1466074:1:1",client,"0",['test','test']) results = await toonitalia({'streams': []},"tt0096697:1:1",client,"0",['test','test'])
print(results) print(results)
-1
View File
@@ -5,7 +5,6 @@ import logging
with open('config.json') as f: with open('config.json') as f:
# Load JSON data from file # Load JSON data from file
config = json.load(f) config = json.load(f)
# Accessing SC_DOMAIN # Accessing SC_DOMAIN
SITE = config["Siti"] SITE = config["Siti"]
SC_DOMAIN = SITE["StreamingCommunity"]['url'] SC_DOMAIN = SITE["StreamingCommunity"]['url']
+64
View File
@@ -0,0 +1,64 @@
link = 'https://raw.githubusercontent.com/Arrowar/SC_Domains/main/domains.json'
import json
import os
import logging
from Src.Utilities.config import setup_logging
import Src.Utilities.config as config
level = config.LEVEL
logger = setup_logging(level)
async def fetch_domain(client,site_name):
response = await client.get(link)
data = response.json()
domain = data[site_name[0]]['full_url'][:-1]
return domain
def write_config(domain,site_name):
try:
json_file_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'config.json')
with open(json_file_path, 'r') as json_file:
config_data = json.load(json_file)
try:
config_data['Siti'][site_name[1]]['url'] = domain
with open(json_file_path, 'w') as json_file:
json.dump(config_data, json_file, indent=4)
return True
except Exception as e:
with open(json_file_path, 'w') as json_file:
json.dump(config_data, json_file, indent=4)
logger.info('Failed to write into config: ',e)
return False
except Exception as e:
logger.info('Failed to write into config: ',e)
return False
async def update_site(client,site_name):
try:
domain = await fetch_domain(client,site_name)
result = write_config(domain,site_name)
return result
except Exception as e:
return False
async def update_all_sites(client):
try:
sites = [['cb01new','CB01'],['guardaserie','Guardaserie'],['eurostreamings','Eurostreaming'],['guardaplay','Guardaflix'],['guardoserie_2','Guardoserie'],['animeworld','AnimeWorld'],['toonitalia','Toonitalia']]
for item in sites:
domain = await fetch_domain(client,item)
write_config(domain,item)
except Exception as e:
logger.info('Failed to update domains: ',e)
async def test_update_site():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
result = await update_site(client,['guardoserie_2','Guardoserie'])
#result = await update_all_sites(client)
#domain = await update_site(client,['eurostreamings','Eurostreaming'])
#write_config(domain,['eurostreamings','Eurostreaming'])
if __name__ == "__main__":
import asyncio
asyncio.run(test_update_site())
+11
View File
@@ -19,6 +19,7 @@ from Src.API.realtime import search_catalog as realtime
from Src.API.realtime import meta_catalog as meta_catalog_realtime from Src.API.realtime import meta_catalog as meta_catalog_realtime
from Src.API.realtime import realtime as streams_realtime from Src.API.realtime import realtime as streams_realtime
from Src.Utilities.dictionaries import STREAM,extra_sources,provider_map from Src.Utilities.dictionaries import STREAM,extra_sources,provider_map
from Src.Utilities.update_config import update_all_sites
from Src.API.epg import tivu, tivu_get,epg_guide,convert_bho_1,convert_bho_2,convert_bho_3 from Src.API.epg import tivu, tivu_get,epg_guide,convert_bho_1,convert_bho_2,convert_bho_3
from Src.API.extractors.uprot import get_uprot_numbers,generate_uprot_txt from Src.API.extractors.uprot import get_uprot_numbers,generate_uprot_txt
import logging import logging
@@ -346,6 +347,16 @@ async def execute_uprot(request: Request,user_input = Form(...),PHPSESSID: str =
elif status == False: elif status == False:
return static.TemplateResponse('uprot.html',{'request':request,"image_url": 'https://tinyurl.com/tryagaindumb'}) return static.TemplateResponse('uprot.html',{'request':request,"image_url": 'https://tinyurl.com/tryagaindumb'})
@app.get('/update')
async def update(request: Request):
async with AsyncSession(proxies = proxies) as client:
result = await update_all_sites(client)
if result:
return JSONResponse(content={"message": "200"})
if not result:
return JSONResponse(content={"message": "Failed"})
if __name__ == '__main__': if __name__ == '__main__':
import uvicorn import uvicorn
uvicorn.run("run:app", host=HOST, port=PORT, log_level=level) uvicorn.run("run:app", host=HOST, port=PORT, log_level=level)