Fix regex
This commit is contained in:
parent
8c3af7029e
commit
53562f4873
3 changed files with 4 additions and 3 deletions
|
@ -24,7 +24,7 @@ class DownloadFactory:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pull_lever(url: str) -> Type[BaseDownloader]:
|
def pull_lever(url: str) -> Type[BaseDownloader]:
|
||||||
sanitised_url = DownloadFactory.sanitise_url(url)
|
sanitised_url = DownloadFactory.sanitise_url(url)
|
||||||
if re.match(r'(i\.)?imgur.*\.gif.*$', sanitised_url):
|
if re.match(r'(i\.)?imgur.*\.gif.+$', sanitised_url):
|
||||||
return Imgur
|
return Imgur
|
||||||
elif re.match(r'.*/.*\.\w{3,4}(\?[\w;&=]*)?$', sanitised_url) and \
|
elif re.match(r'.*/.*\.\w{3,4}(\?[\w;&=]*)?$', sanitised_url) and \
|
||||||
not DownloadFactory.is_web_resource(sanitised_url):
|
not DownloadFactory.is_web_resource(sanitised_url):
|
||||||
|
|
|
@ -42,9 +42,9 @@ class Imgur(BaseDownloader):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_data(link: str) -> dict:
|
def _get_data(link: str) -> dict:
|
||||||
link = link.rstrip('?')
|
link = link.rstrip('?')
|
||||||
if re.match(r'(?i).*\.gif.*$', link):
|
if re.match(r'(?i).*\.gif.+$', link):
|
||||||
link = link.replace('i.imgur', 'imgur')
|
link = link.replace('i.imgur', 'imgur')
|
||||||
link = re.sub('(?i)\\.gif.*$', '', link)
|
link = re.sub('(?i)\\.gif.+$', '', link)
|
||||||
|
|
||||||
res = Imgur.retrieve_url(link, cookies={'over18': '1', 'postpagebeta': '0'})
|
res = Imgur.retrieve_url(link, cookies={'over18': '1', 'postpagebeta': '0'})
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ from bdfr.site_downloaders.youtube import Youtube
|
||||||
('https://imgur.com/BuzvZwb.gifv', Imgur),
|
('https://imgur.com/BuzvZwb.gifv', Imgur),
|
||||||
('https://i.imgur.com/6fNdLst.gif', Direct),
|
('https://i.imgur.com/6fNdLst.gif', Direct),
|
||||||
('https://imgur.com/a/MkxAzeg', Imgur),
|
('https://imgur.com/a/MkxAzeg', Imgur),
|
||||||
|
('https://i.imgur.com/OGeVuAe.giff', Imgur),
|
||||||
('https://www.reddit.com/gallery/lu93m7', Gallery),
|
('https://www.reddit.com/gallery/lu93m7', Gallery),
|
||||||
('https://gfycat.com/concretecheerfulfinwhale', Gfycat),
|
('https://gfycat.com/concretecheerfulfinwhale', Gfycat),
|
||||||
('https://www.erome.com/a/NWGw0F09', Erome),
|
('https://www.erome.com/a/NWGw0F09', Erome),
|
||||||
|
|
Loading…
Reference in a new issue