1
0

Regex limited to up to 4 characters after first dot occured.

This commit is contained in:
Alexander Andreev 2020-07-20 03:44:48 +04:00
parent 6df9e573aa
commit 93d2904a4f
3 changed files with 3 additions and 3 deletions

View File

@ -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']

View File

@ -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']}"

View File

@ -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']}"