fix auto domain

This commit is contained in:
Ghost 2024-03-01 16:15:51 +01:00
parent fbca52d89f
commit fe0cb97a9d
6 changed files with 17 additions and 33 deletions

View File

@ -11,28 +11,27 @@ from bs4 import BeautifulSoup
def domain_version():
domain_req = requests.get("https://api.telegra.ph/getPage/Link-Aggiornato-StreamingCommunity-01-17")
domain = domain_req.json()['result']['description']
domain = domain_req.json()['result']['description'].split(".")[1]
console.print("[green]Get rules ...")
req_repo = None
while True:
console.print(f"[blue]Test domain [white]=> [red]{domain}")
site_url = domain
site_url = f"https://streamingcommunity.{domain}"
try:
site_request = requests.get(site_url, headers={'user-agent': get_headers()})
soup = BeautifulSoup(site_request.text, "lxml")
version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version']
console.print(f"[blue]Rules [white]=> [red].{domain}")
return domain, version
except Exception as e:
console.log("[red]Cant get version, problem with domain. Try again.")
domain = None
continue
sys.exit(0)
def search(title_search, domain):
req = requests.get(f"{domain}/api/search?q={title_search}", headers={'user-agent': get_headers()})
req = requests.get(f"https://streamingcommunity.{domain}/api/search?q={title_search}", headers={'user-agent': get_headers()})
if req.ok:
return [{'name': title['name'], 'type': title['type'], 'id': title['id'], 'slug': title['slug']} for title in

View File

@ -44,5 +44,5 @@ def main_update():
print("\n")
console.print(f"[red]{repo_name} was downloaded [yellow]{down_count} [red]times, but only [yellow]{percentual_stars}% [red]of You(!!) have starred it. \n\
[cyan]Help the repository grow today, by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it to others online!")
time.sleep(2.5)
time.sleep(3)
print("\n")

View File

@ -8,15 +8,3 @@ import logging
# Variable
msg = Prompt()
console = Console()
SAVE_DEBUG = False
class ConfigurazioneLogger:
def __init__(self, nome_file_log='debug.log'):
self.nome_file_log = nome_file_log
self.configura_logger()
def configura_logger(self):
if SAVE_DEBUG:
logging.basicConfig(filename=self.nome_file_log, filemode='w', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
config_logger = ConfigurazioneLogger()

View File

@ -21,5 +21,3 @@ def remove_file(file_path):
print(f"Error removing file '{file_path}': {e}")
else:
print(f"File '{file_path}' does not exist.")
time.sleep(1)

View File

@ -1 +0,0 @@
{"domain": "report"}