1
0

sub and com ->subject and comment. Fixed arguments for match function.

This commit is contained in:
Alexander Andreev 2020-11-18 23:43:43 +04:00
parent 2043fc277f
commit 6a54b88498

View File

@ -26,9 +26,9 @@ class DvachParser(Parser):
@property @property
def op(self) -> Optional[str]: def op(self) -> Optional[str]:
op = "" op = ""
if 'sub' in self._op_post: if 'subject' in self._op_post:
op = f"{self._op_post['subject']}\n" op = f"{self._op_post['subject']}\n"
if 'com' in self._op_post: if 'comment' in self._op_post:
op += self._op_post['comment'] op += self._op_post['comment']
return op if not op == "" else None return op if not op == "" else None
@ -36,7 +36,9 @@ class DvachParser(Parser):
if not 'files' in post: return None if not 'files' in post: return None
files = [] files = []
for f in post['files']: for f in post['files']:
if match(f['fullname'], r"^image\.\w{1,4}$") is None: if 'sticker' in f:
continue
if match(r"^image\.\w+$", f['fullname']) is None:
fullname = f['fullname'] fullname = f['fullname']
else: else:
fullname = f['name'] fullname = f['name']