From 93d2904a4f3ffb0c93e6e7ac26316f8b023724dd Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 20 Jul 2020 03:44:48 +0400 Subject: [PATCH] Regex limited to up to 4 characters after first dot occured. --- scrapthechan/parsers/dvach.py | 2 +- scrapthechan/parsers/fourchan.py | 2 +- scrapthechan/parsers/lainchan.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scrapthechan/parsers/dvach.py b/scrapthechan/parsers/dvach.py index e4378fd..b5d2592 100644 --- a/scrapthechan/parsers/dvach.py +++ b/scrapthechan/parsers/dvach.py @@ -36,7 +36,7 @@ class DvachParser(Parser): if not 'files' in post: return None files = [] for f in post['files']: - if match(f['fullname'], r"^image\.\w+$") is None: + if match(f['fullname'], r"^image\.\w{1,4}$") is None: fullname = f['fullname'] else: fullname = f['name'] diff --git a/scrapthechan/parsers/fourchan.py b/scrapthechan/parsers/fourchan.py index 179bd81..15c3fdb 100644 --- a/scrapthechan/parsers/fourchan.py +++ b/scrapthechan/parsers/fourchan.py @@ -38,7 +38,7 @@ class FourChanParser(Parser): dlfname = f"{post['tim']}{post['ext']}" if "filename" in post: - if match(post['filename'], r"^image\.\w+$") is None: + if match(post['filename'], r"^image\.\w{1,4}$") is None: filename = dlfname else: filename = f"{post['filename']}{post['ext']}" diff --git a/scrapthechan/parsers/lainchan.py b/scrapthechan/parsers/lainchan.py index cb251b4..243bd46 100644 --- a/scrapthechan/parsers/lainchan.py +++ b/scrapthechan/parsers/lainchan.py @@ -41,7 +41,7 @@ class LainchanParser(Parser): dlfname = f"{post['tim']}{post['ext']}" if "filename" in post: - if match(post['filename'], r"^image\.\w+$") is None: + if match(post['filename'], r"^image\.\w{1,4}$") is None: filename = dlfname else: filename = f"{post['filename']}{post['ext']}"