Files
ohm_streaming/app/downloaders/video_players/unfichier.py
T
Kimi Agent 520be53901
CI / Test (Python 3.11) (push) Has been cancelled
CI / Test (Python 3.12) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Summary (push) Has been cancelled
fix: migrations, auth, providers health check, E2E tests, remove neko-sama
- Add proper Alembic initial migration (0001_initial_schema.py)
- Migrate refresh tokens from JSON file to SQLite (RefreshTokenTable)
- Remove Neko-Sama provider entirely (redirects to Gupy, not a host)
- Fix provider health check always showing UNKNOWN
  - Run check_all_health() on startup
  - Fix POST /providers/health/check background task bug
  - Add HTMX refresh after manual health check trigger
- Fix anime search relevance scoring with MIN_RELEVANCE_THRESHOLD=0.5
- Replace bare 'except:' with 'except Exception:' across codebase
- Add Playwright E2E test suite (12 tests, auth setup, helpers)
- Fix toast container blocking clicks via pointer-events: none
- Remove obsolete Jest/Vite test files and config
- Clean up obsolete test_watchlist scripts
- Update sonarr model comment for active providers
2026-05-12 11:45:56 +00:00

52 lines
2.2 KiB
Python

from .base import BaseVideoPlayer
from bs4 import BeautifulSoup
import re
import httpx
class UnFichierDownloader(BaseVideoPlayer):
"""Downloader for 1fichier.com"""
def can_handle(self, url: str) -> bool:
return any(domain in url.lower() for domain in ["1fichier.com", "1fichier.fr"])
async def get_download_link(self, url: str) -> tuple[str, str]:
try:
# Initial page
response = await self.client.get(url)
response.raise_for_status()
# Check if we need to wait (download button)
soup = BeautifulSoup(response.text, 'lxml')
# Check for direct download link
download_link = soup.find('a', class_='btn btn-download')
if download_link and download_link.get('href'):
download_url = download_link['href']
# Follow to get headers for filename
head_resp = await self.client.head(download_url)
filename = self._extract_filename_from_headers(head_resp.headers)
if not filename:
filename = download_url.split('/')[-1] or "downloaded_file"
return download_url, filename
# Alternative: look for any download link in the page
for link in soup.find_all('a', href=True):
href = link['href']
if href.startswith('http') and '1fichier' not in href:
# Try to head the URL to see if it's a file
try:
head_resp = await self.client.head(href, timeout=5.0)
if 'content-length' in head_resp.headers or 'attachment' in head_resp.headers.get('content-disposition', ''):
filename = self._extract_filename_from_headers(head_resp.headers)
if not filename:
filename = href.split('/')[-1] or "downloaded_file"
return href, filename
except Exception:
continue
raise Exception("Could not find download link on page")
except Exception as e:
raise Exception(f"Error extracting 1fichier link: {str(e)}")