Fixed issue where file extenions not found and auth timeout
This commit is contained in:
@@ -24,8 +24,14 @@ from bdfr.site_downloaders.youtube import Youtube
|
||||
class DownloadFactory:
|
||||
@staticmethod
|
||||
def pull_lever(url: str) -> type[BaseDownloader]:
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
sanitised_url = DownloadFactory.sanitise_url(url).lower()
|
||||
logger.debug(f"Selecting downloader for URL: {url} (sanitized: {sanitised_url})")
|
||||
|
||||
if re.match(r"(i\.|m\.|o\.)?imgur", sanitised_url):
|
||||
logger.debug("Using Imgur downloader")
|
||||
return Imgur
|
||||
elif re.match(r"(i\.|thumbs\d\.|v\d\.)?(redgifs|gifdeliverynetwork)", sanitised_url):
|
||||
return Redgifs
|
||||
|
||||
@@ -20,12 +20,19 @@ class YtdlpFallback(BaseFallbackDownloader, Youtube):
|
||||
super(YtdlpFallback, self).__init__(post)
|
||||
|
||||
def find_resources(self, authenticator: Optional[SiteAuthenticator] = None) -> list[Resource]:
|
||||
logger.debug(f"YtdlpFallback processing URL: {self.post.url}")
|
||||
video_attrs = super().get_video_attributes(self.post.url)
|
||||
logger.debug(f"Video attributes: {video_attrs}")
|
||||
extension = video_attrs.get("ext", None)
|
||||
logger.debug(f"Using extension: {extension}")
|
||||
|
||||
out = Resource(
|
||||
self.post,
|
||||
self.post.url,
|
||||
super()._download_video({}),
|
||||
super().get_video_attributes(self.post.url)["ext"],
|
||||
extension,
|
||||
)
|
||||
logger.debug(f"Created resource with extension: {out.extension}")
|
||||
return [out]
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user