Add PornHub module

This commit is contained in:
Serene-Arc
2021-06-25 17:47:49 +10:00
parent 8b1a3d9abc
commit 1a52dfdcbc
4 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# coding=utf-8
import logging
import tempfile
from pathlib import Path
from typing import Optional
import youtube_dl
from praw.models import Submission
from bdfr.exceptions import NotADownloadableLinkError, SiteDownloaderError
from bdfr.resource import Resource
from bdfr.site_authenticator import SiteAuthenticator
from bdfr.site_downloaders.youtube import Youtube
logger = logging.getLogger(__name__)
class PornHub(Youtube):
def __init__(self, post: Submission):
super().__init__(post)
def find_resources(self, authenticator: Optional[SiteAuthenticator] = None) -> list[Resource]:
ytdl_options = {
'format': 'best',
'nooverwrites': True,
}
out = self._download_video(ytdl_options)
return [out]