1
0
Fork 0
mirror of synced 2024-05-21 20:52:48 +12:00

Remove VReddit downloader module

This commit is contained in:
Serene-Arc 2021-05-02 20:02:34 +10:00 committed by Serene
parent ab96a3ba97
commit c9cde54a72
5 changed files with 2 additions and 49 deletions

View file

@ -15,7 +15,6 @@ from bdfr.site_downloaders.gfycat import Gfycat
from bdfr.site_downloaders.imgur import Imgur
from bdfr.site_downloaders.redgifs import Redgifs
from bdfr.site_downloaders.self_post import SelfPost
from bdfr.site_downloaders.vreddit import VReddit
from bdfr.site_downloaders.youtube import Youtube
@ -39,8 +38,6 @@ class DownloadFactory:
return Redgifs
elif re.match(r'reddit\.com/r/', sanitised_url):
return SelfPost
elif re.match(r'v\.redd\.it', sanitised_url):
return VReddit
elif re.match(r'(m\.)?youtu\.?be', sanitised_url):
return Youtube
elif re.match(r'i\.redd\.it.*', sanitised_url):

View file

@ -1,21 +0,0 @@
#!/usr/bin/env python3
import logging
from typing import Optional
from praw.models import Submission
from bdfr.resource import Resource
from bdfr.site_authenticator import SiteAuthenticator
from bdfr.site_downloaders.youtube import Youtube
logger = logging.getLogger(__name__)
class VReddit(Youtube):
def __init__(self, post: Submission):
super().__init__(post)
def find_resources(self, authenticator: Optional[SiteAuthenticator] = None) -> list[Resource]:
out = super()._download_video({})
return [out]

View file

@ -25,6 +25,7 @@ def test_can_handle_link(test_url: str, expected: bool):
('https://streamable.com/dt46y', '1e7f4928e55de6e3ca23d85cc9246bbb'),
('https://streamable.com/t8sem', '49b2d1220c485455548f1edbc05d4ecf'),
('https://www.reddit.com/r/specializedtools/comments/n2nw5m/bamboo_splitter/', '21968d3d92161ea5e0abdcaf6311b06c'),
('https://v.redd.it/9z1dnk3xr5k61', '351a2b57e888df5ccbc508056511f38d'),
))
def test_find_resources(test_url: str, expected_hash: str):
test_submission = MagicMock()

View file

@ -15,13 +15,11 @@ from bdfr.site_downloaders.gfycat import Gfycat
from bdfr.site_downloaders.imgur import Imgur
from bdfr.site_downloaders.redgifs import Redgifs
from bdfr.site_downloaders.self_post import SelfPost
from bdfr.site_downloaders.vreddit import VReddit
from bdfr.site_downloaders.youtube import Youtube
@pytest.mark.online
@pytest.mark.parametrize(('test_submission_url', 'expected_class'), (
('https://v.redd.it/9z1dnk3xr5k61', VReddit),
('https://www.reddit.com/r/TwoXChromosomes/comments/lu29zn/i_refuse_to_live_my_life'
'_in_anything_but_comfort/', SelfPost),
('https://i.imgur.com/bZx1SJQ.jpg', Direct),
@ -42,6 +40,7 @@ from bdfr.site_downloaders.youtube import Youtube
('https://i.imgur.com/3SKrQfK.jpg?1', Direct),
('https://dynasty-scans.com/system/images_images/000/017/819/original/80215103_p0.png?1612232781', Direct),
('https://m.imgur.com/a/py3RW0j', Imgur),
('https://v.redd.it/9z1dnk3xr5k61', YoutubeDlFallback),
('https://streamable.com/dt46y', YoutubeDlFallback),
('https://vimeo.com/channels/31259/53576664', YoutubeDlFallback),
('http://video.pbs.org/viralplayer/2365173446/', YoutubeDlFallback),

View file

@ -1,23 +0,0 @@
#!/usr/bin/env python3
# coding=utf-8
import praw
import pytest
from bdfr.resource import Resource
from bdfr.site_downloaders.vreddit import VReddit
@pytest.mark.online
@pytest.mark.reddit
@pytest.mark.parametrize('test_submission_id', (
'lu8l8g',
))
def test_find_resources(test_submission_id: str, reddit_instance: praw.Reddit):
test_submission = reddit_instance.submission(id=test_submission_id)
downloader = VReddit(test_submission)
resources = downloader.find_resources()
assert len(resources) == 1
assert isinstance(resources[0], Resource)
resources[0].download(120)
assert resources[0].content is not None