feat: Add SendVid downloader support
Add complete support for SendVid video hosting service used by Anime-Sama for anime series like Hell's Paradise. Changes: - Create SendVidDownloader class with proper headers to avoid 403 errors - Add SendVid detection and handling in AnimeSamaDownloader - Update download_manager to include SendVid-specific headers - Support custom episode naming (e.g., "Hells Paradise - Episode 01.mp4") Technical details: - SendVid embed pages require User-Agent and Referer headers - Direct MP4 URLs extracted from <source> tags with IP/time-based parameters - Tested with Hell's Paradise Episode 01 (7MB, 24min, 1280x720) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
from .base import BaseDownloader
|
||||
from bs4 import BeautifulSoup
|
||||
import re
|
||||
import httpx
|
||||
|
||||
|
||||
class DoodStreamDownloader(BaseDownloader):
|
||||
"""Downloader for doodstream.com"""
|
||||
|
||||
def can_handle(self, url: str) -> bool:
|
||||
return any(domain in url.lower() for domain in ["doodstream.com", "dood.stream", "dood.to", "dood.lol", "dood.cx", "dood.so", "dood.watch", "dood.sh"])
|
||||
|
||||
async def get_download_link(self, url: str) -> tuple[str, str]:
|
||||
try:
|
||||
# Get the page
|
||||
response = await self.client.get(url)
|
||||
response.raise_for_status()
|
||||
soup = BeautifulSoup(response.text, 'lxml')
|
||||
|
||||
# Doodstream usually has the video URL in a script with '$(function)'
|
||||
# or in a token-based system
|
||||
download_url = None
|
||||
filename = "doodstream_video.mp4"
|
||||
|
||||
# Method 1: Look for /pass_md5 or similar patterns
|
||||
scripts = soup.find_all('script')
|
||||
for script in scripts:
|
||||
if script.string:
|
||||
# Look for token patterns
|
||||
match = re.search(r'https?://[^\"\']+\.(?:mp4|mkv|avi)', script.string)
|
||||
if match:
|
||||
download_url = match.group(0)
|
||||
break
|
||||
|
||||
# Look for doodstream CDN patterns
|
||||
match = re.search(r'(https?://[^\s\"\'<>]+/download/[^\s\"\'<>]+)', script.string)
|
||||
if match:
|
||||
download_url = match.group(0)
|
||||
break
|
||||
|
||||
# Method 2: Try to construct download URL from page
|
||||
if not download_url:
|
||||
# Extract video ID from URL
|
||||
# Format: https://doodstream.com/e/VIDEO_ID or /d/VIDEO_ID
|
||||
video_id_match = re.search(r'/[ed]/([a-zA-Z0-9]+)', url)
|
||||
if video_id_match:
|
||||
video_id = video_id_match.group(1)
|
||||
# Try direct download pattern
|
||||
download_url = f"https://dood.stream/e/{video_id}"
|
||||
|
||||
# Method 3: Look for any MP4 source in iframes or video tags
|
||||
if not download_url:
|
||||
video = soup.find('video')
|
||||
if video and video.get('src'):
|
||||
download_url = video['src']
|
||||
else:
|
||||
sources = soup.find_all('source')
|
||||
for source in sources:
|
||||
if source.get('src'):
|
||||
download_url = source['src']
|
||||
filename = source.get('src', '').split('/')[-1]
|
||||
break
|
||||
|
||||
if download_url:
|
||||
# Try to get real filename from HEAD request
|
||||
try:
|
||||
head_resp = await self.client.head(download_url, timeout=5.0)
|
||||
fname = self._extract_filename_from_headers(head_resp.headers)
|
||||
if fname:
|
||||
filename = fname
|
||||
except:
|
||||
pass
|
||||
|
||||
return download_url, filename
|
||||
|
||||
raise Exception("Could not extract download link from Doodstream page")
|
||||
|
||||
except Exception as e:
|
||||
raise Exception(f"Error extracting Doodstream link: {str(e)}")
|
||||
Reference in New Issue
Block a user