diff --git a/bdfr/site_downloaders/download_factory.py b/bdfr/site_downloaders/download_factory.py index 8324cd0..7035dc2 100644 --- a/bdfr/site_downloaders/download_factory.py +++ b/bdfr/site_downloaders/download_factory.py @@ -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): diff --git a/bdfr/site_downloaders/vreddit.py b/bdfr/site_downloaders/vreddit.py deleted file mode 100644 index bff96be..0000000 --- a/bdfr/site_downloaders/vreddit.py +++ /dev/null @@ -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] diff --git a/tests/site_downloaders/fallback_downloaders/youtubedl_fallback.py b/tests/site_downloaders/fallback_downloaders/youtubedl_fallback.py index 7f393b6..f70a91c 100644 --- a/tests/site_downloaders/fallback_downloaders/youtubedl_fallback.py +++ b/tests/site_downloaders/fallback_downloaders/youtubedl_fallback.py @@ -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() diff --git a/tests/site_downloaders/test_download_factory.py b/tests/site_downloaders/test_download_factory.py index 36580e0..f02e9f7 100644 --- a/tests/site_downloaders/test_download_factory.py +++ b/tests/site_downloaders/test_download_factory.py @@ -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), diff --git a/tests/site_downloaders/test_vreddit.py b/tests/site_downloaders/test_vreddit.py deleted file mode 100644 index ac83a9e..0000000 --- a/tests/site_downloaders/test_vreddit.py +++ /dev/null @@ -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