api: From cb01blog to cb01new

This commit is contained in:
Lovi 2025-03-16 09:48:08 +01:00
parent 542b090434
commit 477637ee5c
4 changed files with 11 additions and 5 deletions

3
.gitignore vendored
View File

@ -51,4 +51,5 @@ note.txt
cmd.txt
bot_config.json
scripts.json
active_requests.json
active_requests.json
domains.json

View File

@ -634,6 +634,9 @@ The API-based domain updates are currently deprecated. To use it anyway, set `us
Note: If `use_api` is set to `false` and no `domains.json` file is found, the script will raise an error.
#### 💡 Adding a New Site to the Legacy API
If you want to add a new site to the legacy API, just message me on the Discord server, and I'll add it!
# COMMAND
- Download a specific season by entering its number.

View File

@ -40,7 +40,7 @@ def title_search(word_to_search: str) -> int:
media_search_manager.clear()
table_show_manager.clear()
search_url = f"{site_constant.FULL_URL}/?story={word_to_search}&do=search&subaction=search"
search_url = f"{site_constant.FULL_URL}/?s={word_to_search}"
console.print(f"[cyan]Search url: [yellow]{search_url}")
try:
@ -54,10 +54,11 @@ def title_search(word_to_search: str) -> int:
# Create soup and find table
soup = BeautifulSoup(response.text, "html.parser")
for div in soup.find_all("div", class_ = "short-main"):
for card in soup.find_all("div", class_=["card", "mp-post", "horizontal"]):
try:
url = div.find("a").get("href")
title = div.find("a").get_text(strip=True)
title_tag = card.find("h3", class_="card-title").find("a")
url = title_tag.get("href")
title = title_tag.get_text(strip=True)
title_info = {
'name': title,

View File

@ -196,6 +196,7 @@ class ConfigManager:
except Exception as e:
logging.error(f"Error reading configuration file: {e}")
console.print(f"[bold red]Failed to read configuration:[/bold red] {str(e)}")
sys.exit(0)
def download_requirements(self, url: str, filename: str) -> None:
"""