feat: flat design Sunset Glitch + download manager + settings + recommendations overhaul
- Sunset Glitch color palette applied to all templates - Font Awesome icons throughout UI - Download manager with parallel queue and progress tracking - Settings page with dynamic configuration - Recommendations router enhanced with scoring - Local vendor libs (Alpine.js, HTMX) for offline support - Auto test suite with screenshots - Series releases list component - New download model
This commit is contained in:
@@ -144,12 +144,34 @@ class AnimeSamaDownloader(BaseAnimeSite):
|
||||
logger.info(f"Direct video URL detected: {url[:60]}... -> {filename}")
|
||||
return url, filename
|
||||
|
||||
# Check if URL contains the anime page context (format: video_url|anime_page_url|episode_title?)
|
||||
# Check if URL contains the anime page context (format: video_url|...|anime_page_url|episode_title)
|
||||
# The LAST two parts are always anime_page_url and episode_title.
|
||||
# Everything before them is video URLs (multiple sources for fallback).
|
||||
if "|" in url:
|
||||
parts = url.split("|")
|
||||
video_url = parts[0]
|
||||
anime_page_url = parts[1] if len(parts) > 1 else None
|
||||
episode_title = parts[2] if len(parts) > 2 else None
|
||||
# Correctly identify anime_page_url (2nd to last) and episode_title (last)
|
||||
if len(parts) >= 3:
|
||||
# Multiple video URLs + anime_page_url + episode_title
|
||||
potential_anime_url = parts[-2].strip()
|
||||
potential_title = parts[-1].strip()
|
||||
# Validate: anime_page_url should look like a URL
|
||||
# episode_title should NOT look like a URL
|
||||
if potential_title and not potential_title.startswith("http"):
|
||||
anime_page_url = potential_anime_url if potential_anime_url.startswith("http") else None
|
||||
episode_title = potential_title
|
||||
elif len(parts) >= 5 and parts[-2].startswith("http"):
|
||||
# Last part is also a URL (no episode title) - 2nd to last is anime page URL
|
||||
anime_page_url = potential_anime_url
|
||||
episode_title = None
|
||||
else:
|
||||
anime_page_url = None
|
||||
episode_title = None
|
||||
# Pass the full URL to fallback (it parses correctly)
|
||||
video_url = url
|
||||
else:
|
||||
video_url = parts[0]
|
||||
anime_page_url = parts[1] if len(parts) > 1 else None
|
||||
episode_title = None
|
||||
|
||||
logger.debug(
|
||||
f"Split URL - video: {video_url[:60]}..., anime: {anime_page_url}, episode: {episode_title}"
|
||||
@@ -160,6 +182,7 @@ class AnimeSamaDownloader(BaseAnimeSite):
|
||||
video_url,
|
||||
anime_page_url=anime_page_url,
|
||||
episode_title=episode_title,
|
||||
target_filename=target_filename,
|
||||
)
|
||||
|
||||
# Check if this is a third-party host URL
|
||||
|
||||
@@ -23,7 +23,7 @@ class FS7Downloader(BaseSeriesSite):
|
||||
self.id = "fs7"
|
||||
self.provider_id = "fs7"
|
||||
self.default_domain = "fs7.lol"
|
||||
self.test_tlds = ["lol", "com", "net", "org", "tv", "ws", "cc", "co"]
|
||||
self.test_tlds = ["lol", "one", "site", "vip", "fun", "stream", "com", "net", "org", "tv", "ws", "cc", "co"]
|
||||
self.base_url = f"https://{self.default_domain}"
|
||||
self._domain_checked = False
|
||||
self.client.headers.update(
|
||||
@@ -234,35 +234,93 @@ class FS7Downloader(BaseSeriesSite):
|
||||
# Clean up title: remove "affiche" suffix
|
||||
title = re.sub(r"\s+affiche$", "", title, flags=re.IGNORECASE).strip()
|
||||
|
||||
# Extract description/synopsis
|
||||
description_elem = soup.find("div", class_="full-text")
|
||||
description = (
|
||||
description_elem.get_text(strip=True) if description_elem else ""
|
||||
)
|
||||
# --- Synopsis: div.fdesc > p ---
|
||||
description = ""
|
||||
fdesc = soup.find("div", class_="fdesc")
|
||||
if fdesc:
|
||||
p = fdesc.find("p")
|
||||
if p:
|
||||
description = p.get_text(strip=True)
|
||||
else:
|
||||
description = fdesc.get_text(strip=True)
|
||||
|
||||
# Extract cover image
|
||||
img = soup.find("img", class_="poster")
|
||||
poster_image = img.get("src", "") if img else ""
|
||||
# --- Poster: div.fleft > img ---
|
||||
poster_image = ""
|
||||
fleft = soup.find("div", class_="fleft")
|
||||
if fleft:
|
||||
img = fleft.find("img")
|
||||
if img:
|
||||
poster_image = (
|
||||
img.get("data-src")
|
||||
or img.get("data-original")
|
||||
or img.get("src")
|
||||
or ""
|
||||
)
|
||||
|
||||
# Try to get poster from meta tag if not found
|
||||
# Fallback: img.poster, then og:image
|
||||
if not poster_image:
|
||||
img = soup.find("img", class_="poster")
|
||||
poster_image = img.get("src", "") if img else ""
|
||||
if not poster_image:
|
||||
meta_img = soup.find("meta", property="og:image")
|
||||
poster_image = meta_img.get("content", "") if meta_img else ""
|
||||
|
||||
# Extract year
|
||||
year_match = re.search(r"\b(19|20)\d{2}\b", description)
|
||||
release_year = int(year_match.group()) if year_match else None
|
||||
# --- Year: span.release ---
|
||||
release_year = None
|
||||
release_span = soup.find("span", class_="release")
|
||||
if release_span:
|
||||
year_match = re.search(r"\b(19|20)\d{2}\b", release_span.get_text())
|
||||
if year_match:
|
||||
release_year = int(year_match.group())
|
||||
|
||||
# --- Genres: span.genres ---
|
||||
genres = []
|
||||
genres_span = soup.find("span", class_="genres")
|
||||
if genres_span:
|
||||
genres = [
|
||||
g.strip()
|
||||
for g in genres_span.get_text().split(",")
|
||||
if g.strip()
|
||||
]
|
||||
|
||||
# --- Runtime: span.runtime ---
|
||||
runtime = None
|
||||
runtime_span = soup.find("span", class_="runtime")
|
||||
if runtime_span:
|
||||
runtime = runtime_span.get_text(strip=True)
|
||||
|
||||
# --- Casting info from second div.flist ---
|
||||
original_title = ""
|
||||
director = ""
|
||||
cast = []
|
||||
flists = soup.find_all("div", class_="flist")
|
||||
for fl in flists:
|
||||
text = fl.get_text(strip=True)
|
||||
if "Titre Original" in text:
|
||||
m = re.search(r"Titre Original\s*:\s*(.+?)(?:Réalisateur|$)", text)
|
||||
if m:
|
||||
original_title = m.group(1).strip()
|
||||
m2 = re.search(r"Réalisateur\s*:\s*(.+?)(?:Avec\s*:|$)", text)
|
||||
if m2:
|
||||
director = m2.group(1).strip()
|
||||
m3 = re.search(r"Avec\s*:\s*(.+?)(?:plus|$)", text)
|
||||
if m3:
|
||||
cast = [c.strip() for c in m3.group(1).split(",") if c.strip()]
|
||||
|
||||
return {
|
||||
"title": title,
|
||||
"synopsis": description,
|
||||
"poster_image": poster_image,
|
||||
"release_year": release_year,
|
||||
"genres": [],
|
||||
"genres": genres,
|
||||
"rating": None,
|
||||
"studio": None,
|
||||
"total_episodes": None,
|
||||
"status": None,
|
||||
"original_title": original_title,
|
||||
"director": director,
|
||||
"cast": cast,
|
||||
"runtime": runtime,
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
@@ -301,3 +359,80 @@ class FS7Downloader(BaseSeriesSite):
|
||||
return await player.get_download_link(url, target_filename)
|
||||
else:
|
||||
raise ValueError(f"No video player found for URL: {url}")
|
||||
|
||||
async def get_latest_series(self, limit: int = 20) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Scrape the 'Nouveautés Séries' section from FS7 homepage.
|
||||
|
||||
Returns:
|
||||
List of dicts with title, url, cover_image, synopsis, lang, provider_id.
|
||||
"""
|
||||
await self._ensure_base_url()
|
||||
|
||||
try:
|
||||
resp = await self.client.get(self.base_url + "/", timeout=15)
|
||||
soup = BeautifulSoup(resp.text, "html.parser")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to fetch FS7 homepage: {e}")
|
||||
return []
|
||||
|
||||
results = []
|
||||
|
||||
# Find the 'Nouveautés Séries' section
|
||||
for section in soup.find_all("div", class_="pages"):
|
||||
title_el = section.find("div", class_="sect-t")
|
||||
if not title_el:
|
||||
continue
|
||||
title = title_el.get_text(strip=True)
|
||||
if "Nouveautés" not in title or "Séries" not in title:
|
||||
continue
|
||||
|
||||
for item in section.find_all("div", class_="short"):
|
||||
# Get the poster link (contains real URL)
|
||||
poster_a = item.find("a", class_="short-poster", href=True)
|
||||
if not poster_a:
|
||||
continue
|
||||
|
||||
url = poster_a["href"]
|
||||
if url.startswith("/"):
|
||||
url = self.base_url + url
|
||||
|
||||
# Title from alt attribute
|
||||
title_attr = poster_a.get("alt", "").strip()
|
||||
if not title_attr:
|
||||
continue
|
||||
|
||||
# Poster image
|
||||
img = poster_a.find("img")
|
||||
cover_image = img.get("src", "") if img else ""
|
||||
|
||||
# Synopsis from hidden span
|
||||
desc_span = item.find("span", id=re.compile(r"^desc-\d+"))
|
||||
synopsis = desc_span.get_text(strip=True) if desc_span else ""
|
||||
|
||||
# Language (VF/VOSTFR)
|
||||
lang = "vf"
|
||||
version_span = item.find("span", class_="film-version")
|
||||
if version_span:
|
||||
version_text = version_span.get_text(strip=True).upper()
|
||||
if "VOSTFR" in version_text:
|
||||
lang = "vostfr"
|
||||
elif "VF" in version_text:
|
||||
lang = "vf"
|
||||
|
||||
results.append({
|
||||
"title": title_attr,
|
||||
"url": url,
|
||||
"cover_image": cover_image,
|
||||
"synopsis": synopsis,
|
||||
"lang": lang,
|
||||
"provider_id": self.provider_id,
|
||||
"content_type": "series",
|
||||
})
|
||||
|
||||
if len(results) >= limit:
|
||||
break
|
||||
break # Only process the first matching section
|
||||
|
||||
logger.info(f"FS7 latest series: found {len(results)} items")
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user