Merge pull request #671 from OMEGARAZER/development
This commit is contained in:
commit
3d0ac9e483
3 changed files with 17 additions and 11 deletions
|
@ -78,7 +78,7 @@ class Imgur(BaseDownloader):
|
|||
|
||||
@staticmethod
|
||||
def _validate_extension(extension_suffix: str) -> str:
|
||||
extension_suffix = extension_suffix.strip('?1')
|
||||
extension_suffix = re.sub(r'\?.*', '', extension_suffix)
|
||||
possible_extensions = ('.jpg', '.png', '.mp4', '.gif')
|
||||
selection = [ext for ext in possible_extensions if ext == extension_suffix]
|
||||
if len(selection) == 1:
|
||||
|
|
|
@ -24,14 +24,11 @@ from bdfr.site_downloaders.youtube import Youtube
|
|||
@pytest.mark.parametrize(('test_submission_url', 'expected_class'), (
|
||||
('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', Imgur),
|
||||
('https://i.redd.it/affyv0axd5k61.png', Direct),
|
||||
('https://imgur.com/3ls94yv.jpeg', Imgur),
|
||||
('https://i.imgur.com/BuzvZwb.gifv', Imgur),
|
||||
('https://i.imgur.com/bZx1SJQ.jpg', Imgur),
|
||||
('https://imgur.com/BuzvZwb.gifv', Imgur),
|
||||
('https://i.imgur.com/6fNdLst.gif', Imgur),
|
||||
('https://imgur.com/a/MkxAzeg', Imgur),
|
||||
('https://i.imgur.com/OGeVuAe.giff', Imgur),
|
||||
('https://m.imgur.com/a/py3RW0j', Imgur),
|
||||
('https://www.reddit.com/gallery/lu93m7', Gallery),
|
||||
('https://gfycat.com/concretecheerfulfinwhale', Gfycat),
|
||||
('https://www.erome.com/a/NWGw0F09', Erome),
|
||||
|
@ -40,16 +37,13 @@ from bdfr.site_downloaders.youtube import Youtube
|
|||
('https://www.gifdeliverynetwork.com/repulsivefinishedandalusianhorse', Redgifs),
|
||||
('https://youtu.be/DevfjHOhuFc', Youtube),
|
||||
('https://m.youtube.com/watch?v=kr-FeojxzUM', Youtube),
|
||||
('https://i.imgur.com/3SKrQfK.jpg?1', Imgur),
|
||||
('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', VReddit),
|
||||
('https://streamable.com/dt46y', YtdlpFallback),
|
||||
('https://vimeo.com/channels/31259/53576664', YtdlpFallback),
|
||||
('http://video.pbs.org/viralplayer/2365173446/', YtdlpFallback),
|
||||
('https://www.pornhub.com/view_video.php?viewkey=ph5a2ee0461a8d0', PornHub),
|
||||
('https://www.patreon.com/posts/minecart-track-59346560', Gallery),
|
||||
('https://v.redd.it/9z1dnk3xr5k61', VReddit)
|
||||
))
|
||||
def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit):
|
||||
result = DownloadFactory.pull_lever(test_submission_url)
|
||||
|
|
|
@ -152,11 +152,23 @@ def test_imgur_extension_validation_bad(test_extension: str):
|
|||
),
|
||||
(
|
||||
'https://i.imgur.com/OGeVuAe.giff',
|
||||
('77389679084d381336f168538793f218',)
|
||||
('77389679084d381336f168538793f218',),
|
||||
),
|
||||
(
|
||||
'https://i.imgur.com/OGeVuAe.gift',
|
||||
('77389679084d381336f168538793f218',)
|
||||
('77389679084d381336f168538793f218',),
|
||||
),
|
||||
(
|
||||
'https://i.imgur.com/3SKrQfK.jpg?1',
|
||||
('aa299e181b268578979cad176d1bd1d0',),
|
||||
),
|
||||
(
|
||||
'https://i.imgur.com/cbivYRW.jpg?3',
|
||||
('7ec6ceef5380cb163a1d498c359c51fd',),
|
||||
),
|
||||
(
|
||||
'http://i.imgur.com/s9uXxlq.jpg?5.jpg',
|
||||
('338de3c23ee21af056b3a7c154e2478f',),
|
||||
),
|
||||
))
|
||||
def test_find_resources(test_url: str, expected_hashes: list[str]):
|
||||
|
|
Loading…
Reference in a new issue