Add support for direct links with parameters

This commit is contained in:
Serene-Arc 2021-04-05 15:03:09 +10:00 committed by Ali Parlakci
parent 4b49991cd6
commit c2c3d03205
2 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class DownloadFactory:
url_beginning = r'\s*(https?://(www\.)?)'
if re.match(url_beginning + r'i\.imgur.*\.gifv$', url):
return Imgur
elif re.match(url_beginning + r'.*/.*\.\w{3,4}$', url):
elif re.match(url_beginning + r'.*/.*\.\w{3,4}(\?[\w;&=]*)?$', url):
return Direct
elif re.match(url_beginning + r'erome\.com.*', url):
return Erome

View File

@ -37,6 +37,8 @@ from bulkredditdownloader.site_downloaders.youtube import Youtube
('https://www.gifdeliverynetwork.com/repulsivefinishedandalusianhorse', GifDeliveryNetwork),
('https://youtu.be/DevfjHOhuFc', Youtube),
('https://m.youtube.com/watch?v=kr-FeojxzUM', 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),
))
def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit):
result = DownloadFactory.pull_lever(test_submission_url)