28 lines
806 B
Python
28 lines
806 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any
|
|
|
|
|
|
class Provider(ABC):
|
|
"""Abstract base class for streaming providers."""
|
|
|
|
@abstractmethod
|
|
def get_link(
|
|
self, embedded_link: str, timeout: int
|
|
) -> tuple[str, dict[str, Any]]:
|
|
"""
|
|
Extract direct download link from embedded player link.
|
|
|
|
Args:
|
|
embedded_link: URL of the embedded player
|
|
timeout: Request timeout in seconds
|
|
|
|
Returns:
|
|
Tuple of (direct_link: str, headers: dict)
|
|
- direct_link: Direct URL to download resource
|
|
- headers: Dictionary of HTTP headers to use for download
|
|
"""
|
|
raise NotImplementedError(
|
|
"Streaming providers must implement get_link"
|
|
)
|
|
|