mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 20:15:24 +00:00
fix auto domain
This commit is contained in:
parent
fbca52d89f
commit
fe0cb97a9d
@ -11,28 +11,27 @@ from bs4 import BeautifulSoup
|
|||||||
|
|
||||||
def domain_version():
|
def domain_version():
|
||||||
domain_req = requests.get("https://api.telegra.ph/getPage/Link-Aggiornato-StreamingCommunity-01-17")
|
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 ...")
|
console.print("[green]Get rules ...")
|
||||||
req_repo = None
|
|
||||||
|
|
||||||
while True:
|
|
||||||
console.print(f"[blue]Test domain [white]=> [red]{domain}")
|
console.print(f"[blue]Test domain [white]=> [red]{domain}")
|
||||||
site_url = domain
|
site_url = f"https://streamingcommunity.{domain}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
site_request = requests.get(site_url, headers={'user-agent': get_headers()})
|
site_request = requests.get(site_url, headers={'user-agent': get_headers()})
|
||||||
soup = BeautifulSoup(site_request.text, "lxml")
|
soup = BeautifulSoup(site_request.text, "lxml")
|
||||||
version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version']
|
version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version']
|
||||||
console.print(f"[blue]Rules [white]=> [red].{domain}")
|
console.print(f"[blue]Rules [white]=> [red].{domain}")
|
||||||
|
|
||||||
return domain, version
|
return domain, version
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
console.log("[red]Cant get version, problem with domain. Try again.")
|
console.log("[red]Cant get version, problem with domain. Try again.")
|
||||||
domain = None
|
sys.exit(0)
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
def search(title_search, domain):
|
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:
|
if req.ok:
|
||||||
return [{'name': title['name'], 'type': title['type'], 'id': title['id'], 'slug': title['slug']} for title in
|
return [{'name': title['name'], 'type': title['type'], 'id': title['id'], 'slug': title['slug']} for title in
|
||||||
|
@ -44,5 +44,5 @@ def main_update():
|
|||||||
print("\n")
|
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\
|
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!")
|
[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")
|
print("\n")
|
@ -8,15 +8,3 @@ import logging
|
|||||||
# Variable
|
# Variable
|
||||||
msg = Prompt()
|
msg = Prompt()
|
||||||
console = Console()
|
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()
|
|
@ -21,5 +21,3 @@ def remove_file(file_path):
|
|||||||
print(f"Error removing file '{file_path}': {e}")
|
print(f"Error removing file '{file_path}': {e}")
|
||||||
else:
|
else:
|
||||||
print(f"File '{file_path}' does not exist.")
|
print(f"File '{file_path}' does not exist.")
|
||||||
|
|
||||||
time.sleep(1)
|
|
Loading…
x
Reference in New Issue
Block a user