Fix a crash when downloading a disabled pornhub video
This commit is contained in:
@@ -6,6 +6,7 @@ from typing import Optional
|
||||
|
||||
from praw.models import Submission
|
||||
|
||||
from bdfr.exceptions import SiteDownloaderError
|
||||
from bdfr.resource import Resource
|
||||
from bdfr.site_authenticator import SiteAuthenticator
|
||||
from bdfr.site_downloaders.youtube import Youtube
|
||||
@@ -22,10 +23,15 @@ class PornHub(Youtube):
|
||||
'format': 'best',
|
||||
'nooverwrites': True,
|
||||
}
|
||||
if video_attributes := super().get_video_attributes(self.post.url):
|
||||
extension = video_attributes['ext']
|
||||
else:
|
||||
raise SiteDownloaderError()
|
||||
|
||||
out = Resource(
|
||||
self.post,
|
||||
self.post.url,
|
||||
super()._download_video(ytdl_options),
|
||||
super().get_video_attributes(self.post.url)['ext'],
|
||||
extension,
|
||||
)
|
||||
return [out]
|
||||
|
||||
Reference in New Issue
Block a user