Add fallback downloader

This commit is contained in:
Serene-Arc
2021-05-02 19:48:25 +10:00
committed by Serene
parent a86a41e6a5
commit a8c2136270
7 changed files with 99 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ from bdfr.exceptions import NotADownloadableLinkError
from bdfr.site_downloaders.base_downloader import BaseDownloader
from bdfr.site_downloaders.direct import Direct
from bdfr.site_downloaders.erome import Erome
from bdfr.site_downloaders.fallback_downloaders.youtubedl_fallback import YoutubeDlFallback
from bdfr.site_downloaders.gallery import Gallery
from bdfr.site_downloaders.gfycat import Gfycat
from bdfr.site_downloaders.imgur import Imgur
@@ -47,6 +48,8 @@ class DownloadFactory:
return Streamable
elif re.match(r'i\.redd\.it.*', sanitised_url):
return Direct
elif YoutubeDlFallback.can_handle_link(sanitised_url):
return YoutubeDlFallback
else:
raise NotADownloadableLinkError(
f'No downloader module exists for url {url}')