Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Lovi-0 committed Jan 2, 2025
1 parent 441e761 commit 5d71f81
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 15 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,16 @@ The `run-container` command mounts also the `config.json` file, so any change to

| Website | Status |
|:-------------------|:------:|
| 1337xx ||
| Altadefinizione ||
| AnimeUnity ||
| Ilcorsaronero ||
| CB01New ||
| DDLStreamItaly ||
| GuardaSerie ||
| MostraGuarda ||
| StreamingCommunity ||
| [1337xx](https://1337xx.to/) ||
| [Altadefinizione](https://altadefinizione.prof/) ||
| [AnimeUnity](https://animeunity.so/) ||
| [Ilcorsaronero](https://ilcorsaronero.link/) ||
| [CB01New](https://cb01new.pics/) ||
| [DDLStreamItaly](https://ddlstreamitaly.co/) ||
| [GuardaSerie](https://guardaserie.academy/) ||
| [MostraGuarda](https://mostraguarda.stream/) ||
| [StreamingCommunity](https://streamingcommunity.prof/) ||


# Tutorials

Expand Down
6 changes: 2 additions & 4 deletions StreamingCommunity/Api/Template/Util/get_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,9 @@ def search_domain(site_name: str, base_url: str, get_first: bool = False):
# Get configuration values
max_timeout = config_manager.get_int("REQUESTS", "timeout")
domain = str(config_manager.get_dict("SITE", site_name)['domain'])
test_url = f"{base_url}.{domain}"

try:
# Test current domain configuration
test_url = f"{base_url}.{domain}"

if validate_url(test_url, max_timeout):
parsed_url = urlparse(test_url)
tld = parsed_url.netloc.split('.')[-1]
Expand All @@ -163,7 +161,7 @@ def search_domain(site_name: str, base_url: str, get_first: bool = False):

# Perform Google search if current domain fails
query = base_url.split("/")[-1]
search_results = list(search(query, num_results=10, lang="it"))
search_results = list(search(query, num_results=15, lang="it"))
console.print(f"Google search: {search_results}")

def normalize_for_comparison(url):
Expand Down
43 changes: 41 additions & 2 deletions Test/call_updateDomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

# Variable
console = Console()
README_PATH = "README.md"


def load_site_names():
Expand Down Expand Up @@ -78,13 +79,51 @@ def load_site_names():

return site_names

def update_readme(site_names):
if not os.path.exists(README_PATH):
console.print(f"[red]README file not found at {README_PATH}")
return

with open(README_PATH, "r", encoding="utf-8") as file:
lines = file.readlines()

updated_lines = []

for line in lines:
if line.startswith("| [") and "|" in line:
site_name = line.split("[")[1].split("]")[0]
alias = f"{site_name.lower()}"

if alias in site_names:
domain_to_use, _ = search_domain(site_name=alias, base_url=f"https://{alias}", get_first=True)
print("Update line: ", line)

if site_name == "animeunity":
updated_line = f"| [{site_name}](https://www.{alias}.{domain_to_use}/) | ✅ |\n"
else:
updated_line = f"| [{site_name}](https://{alias}.{domain_to_use}/) | ✅ |\n"

print("To: ", updated_line.strip())
updated_lines.append(updated_line)
continue

updated_lines.append(line)

with open(README_PATH, "w", encoding="utf-8") as file:
file.writelines(updated_lines)

if __name__ == "__main__":
site_names = load_site_names()
for alias, (site_name, use_for) in site_names.items():
print(f"Alias: {alias}, SITE_NAME: {site_name}, Use for: {use_for}")

if site_name == "animeunity":
domain_to_use, _ = search_domain(site_name=site_name, base_url=f"https://www.{site_name}", get_first=True)

else:
domain_to_use, _ = search_domain(site_name=site_name, base_url=f"https://{site_name}", get_first=True)
domain_to_use, _ = search_domain(site_name=site_name, base_url=f"https://{site_name}", get_first=True)


# Update readme
print("\n")
print("Return domain: ", domain_to_use)
update_readme(alias)

0 comments on commit 5d71f81

Please sign in to comment.