Fixed OP's post property. Handled situation when comment and/or subject doesn't exists.
This commit is contained in:
parent
0ed1e896ca
commit
3223c0721a
@ -24,8 +24,13 @@ class DvachParser(Parser):
|
||||
return "2ch.hk"
|
||||
|
||||
@property
|
||||
def op(self) -> str:
|
||||
return f"{self._op_post['subject']}\n{self._op_post['comment']}"
|
||||
def op(self) -> Optional[str]:
|
||||
op = ""
|
||||
if 'sub' in self._op_post:
|
||||
op = f"{self._op_post['subject']}\n"
|
||||
if 'com' in self._op_post:
|
||||
op += self._op_post['comment']
|
||||
return op if not op == "" else None
|
||||
|
||||
def _parse_post(self, post) -> Optional[List[FileInfo]]:
|
||||
if not 'files' in post: return None
|
||||
|
@ -24,11 +24,13 @@ class FourChanParser(Parser):
|
||||
return "4chan.org"
|
||||
|
||||
@property
|
||||
def op(self) -> str:
|
||||
def op(self) -> Optional[str]:
|
||||
op = ""
|
||||
if 'sub' in self._op_post:
|
||||
return f"{self._op_post['sub']}\n{self._op_post['com']}"
|
||||
else:
|
||||
return self._op_post['com']
|
||||
op = f"{self._op_post['sub']}\n"
|
||||
if 'com' in self._op_post:
|
||||
op += self._op_post['com']
|
||||
return op if not op == "" else None
|
||||
|
||||
def _parse_post(self, post: dict) -> List[FileInfo]:
|
||||
if not 'tim' in post: return None
|
||||
|
@ -26,6 +26,15 @@ class LainchanParser(Parser):
|
||||
def imageboard(self) -> str:
|
||||
return "lainchan.org"
|
||||
|
||||
@property
|
||||
def op(self) -> Optional[str]:
|
||||
op = ""
|
||||
if 'sub' in self._op_post:
|
||||
op = f"{self._op_post['sub']}\n"
|
||||
if 'com' in self._op_post:
|
||||
op += self._op_post['com']
|
||||
return op if not op == "" else None
|
||||
|
||||
def _parse_post(self, post) -> List[FileInfo]:
|
||||
if not 'tim' in post: return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user