Skip to content

Reference for youtube_dl_scraper/utils/filename_extractor.py

youtube_dl_scraper.utils.filename_extractor.get_filename_from_cd

get_filename_from_cd(cd: str) -> Optional[str]

Get filename from content-disposition

Source code in youtube_dl_scraper/utils/filename_extractor.py
def get_filename_from_cd(cd: str) -> Optional[str]:
    """
    Get filename from content-disposition
    """
    if not cd:
        return
    filename = re.findall("filename=(.+)", cd)
    if len(filename) == 0:
        return None
    return filename[0].replace('"', "").replace("\\", "")