Skip to content

extract

can_handle

can_handle(url: str) -> bool

Checks if a given URL can be handled by any extractor.

Source code in src/torah_dl/core/extract.py
28
29
30
def can_handle(url: str) -> bool:
    """Checks if a given URL can be handled by any extractor."""
    return any(extractor.can_handle(url) for extractor in EXTRACTORS)

extract

extract(url: str) -> Extraction

Extracts the download URL, title, and file format from a given URL.

Source code in src/torah_dl/core/extract.py
19
20
21
22
23
24
25
def extract(url: str) -> Extraction:
    """Extracts the download URL, title, and file format from a given URL."""
    for extractor in EXTRACTORS:
        if extractor.can_handle(url):
            return extractor.extract(url)

    raise ExtractorNotFoundError(url)