Skip to content

Core API

This section provides a detailed reference for the core components of the TrueLink library.

truelink.TrueLinkResolver

TrueLinkResolver(timeout: int = 30, max_retries: int = 3, proxy: str | None = None)

Main resolver class for extracting direct download links.

Parameters:

Name Type Description Default
timeout int

Request timeout in seconds (default: 30)

30
max_retries int

Maximum number of retries for failed attempts (default: 3)

3
proxy str

Proxy URL (optional)

None

get_supported_domains staticmethod

get_supported_domains() -> list

Get list of supported domains.

Returns:

Type Description
list

List of supported domain patterns

is_supported staticmethod

is_supported(url: str) -> bool

Check if URL is supported.

Parameters:

Name Type Description Default
url str

The URL to check

required

Returns:

Type Description
bool

True if supported, False otherwise

register_resolver classmethod

register_resolver(domain: str, resolver_class: type) -> None

Register a new resolver.

resolve async

resolve(url: str, *, use_cache: bool = False) -> LinkResult | FolderResult

Resolve a URL to direct download link(s) and return as a LinkResult or FolderResult object.

Parameters:

Name Type Description Default
url str

The URL to resolve

required
use_cache bool

Whether to use the cache

False

Returns:

Type Description
LinkResult | FolderResult

A LinkResult or FolderResult object.

Raises:

Type Description
InvalidURLException

If URL is invalid

UnsupportedProviderException

If provider is not supported

ExtractionFailedException

If extraction fails after all retries