1
0
Fork 0
mirror of synced 2024-04-25 07:52:17 +12:00

Add Patreon image support

This commit is contained in:
Serene-Arc 2021-12-19 13:44:24 +10:00
parent 5288b79d1b
commit 36ff95de6b
3 changed files with 11 additions and 0 deletions

View file

@ -33,6 +33,8 @@ class DownloadFactory:
return Erome
elif re.match(r'reddit\.com/gallery/.*', sanitised_url):
return Gallery
elif re.match(r'patreon\.com.*', sanitised_url):
return Gallery
elif re.match(r'gfycat\.', sanitised_url):
return Gfycat
elif re.match(r'(m\.)?imgur.*', sanitised_url):

View file

@ -47,6 +47,7 @@ from bdfr.site_downloaders.youtube import Youtube
('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),
))
def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit):
result = DownloadFactory.pull_lever(test_submission_url)

View file

@ -57,6 +57,14 @@ def test_gallery_get_links(test_ids: list[dict], expected: set[str]):
'65163f685fb28c5b776e0e77122718be',
'2a337eb5b13c34d3ca3f51b5db7c13e9',
}),
('rb3ub6', { # patreon post
'748a976c6cedf7ea85b6f90e7cb685c7',
'839796d7745e88ced6355504e1f74508',
'bcdb740367d0f19f97a77e614b48a42d',
'0f230b8c4e5d103d35a773fab9814ec3',
'e5192d6cb4f84c4f4a658355310bf0f9',
'91cbe172cd8ccbcf049fcea4204eb979',
})
))
def test_gallery_download(test_submission_id: str, expected_hashes: set[str], reddit_instance: praw.Reddit):
test_submission = reddit_instance.submission(id=test_submission_id)