1
0
Fork 0
mirror of synced 2024-06-14 00:04:45 +12:00

Update regex to be more concise, add test for m.youtube.

This commit is contained in:
BlipRanger 2021-04-02 11:51:00 -04:00 committed by Ali Parlakci
parent a49d87e154
commit c9c864b71b
2 changed files with 2 additions and 3 deletions

View file

@ -40,9 +40,7 @@ class DownloadFactory:
return SelfPost
elif re.match(url_beginning + r'v\.redd\.it', url):
return VReddit
elif re.match(url_beginning + r'youtu\.?be', url):
return Youtube
elif re.match(url_beginning + r'm.youtu\.?be', url):
elif re.match(url_beginning + r'(m\.)?youtu\.?be', url):
return Youtube
elif re.match(url_beginning + r'i\.redd\.it.*', url):
return Direct

View file

@ -34,6 +34,7 @@ from bulkredditdownloader.site_downloaders.youtube import Youtube
('https://redgifs.com/watch/courageousimpeccablecanvasback', Redgifs),
('https://www.gifdeliverynetwork.com/repulsivefinishedandalusianhorse', GifDeliveryNetwork),
('https://youtu.be/DevfjHOhuFc', Youtube),
('https://m.youtube.com/watch?v=kr-FeojxzUM', Youtube),
))
def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit):
result = DownloadFactory.pull_lever(test_submission_url)