diff --git a/api2ch/__init__.py b/api2ch/__init__.py index 9285c59..cac63e7 100644 --- a/api2ch/__init__.py +++ b/api2ch/__init__.py @@ -1,7 +1,7 @@ """Async API Wrapper for 2ch Imageboard with typings""" from .api import Api2ch, Api2chAsync, Api2chBase, Api2chError -from .config import API_BASE, api_mirrors, downloads_dir +from .config import API_BASE, BOARDS, api_mirrors, downloads_dir from .helpers import download_thread_media from .models.auxiliary import NewsAbuItem, Tag, TopItem from .models.base import Base, Request, Response @@ -13,10 +13,10 @@ from .models.response import ResponseBoards, ResponseBoardsByTypes, ResponseCatalog, ResponseCatalogByDate, ResponsePage, \ ResponseSinglePost, ResponseThread, ResponseThreadPostsByNum, ResponseThreadPostsByPost, ResponseThreads from .models.thread import Thread, ThreadWithStats -from .utils import parse_url +from .utils import clear_html, convert_html, parse_url __author__ = 'uburuntu' __email__ = 'github@rmbk.me' __license__ = 'MIT' -__version__ = '1.1.0' +__version__ = '1.1.1' diff --git a/api2ch/models/post.py b/api2ch/models/post.py index 958f465..c82feed 100644 --- a/api2ch/models/post.py +++ b/api2ch/models/post.py @@ -4,11 +4,26 @@ from api2ch.config import API_BASE from api2ch.models.base import Base from api2ch.models.file import File, Image, Sticker, Video +from api2ch.utils import clear_html, convert_html class Post(Base): subject: str + + @property + def header(self): + return clear_html(self.subject) + comment: str + + @property + def body(self): + return convert_html(self.comment) + + @property + def body_text(self): + return clear_html(self.comment) + files: List[Union[Image, Video, Sticker, File]] timestamp: int date: str diff --git a/api2ch/models/thread.py b/api2ch/models/thread.py index 29fdd84..51c05f0 100644 --- a/api2ch/models/thread.py +++ b/api2ch/models/thread.py @@ -4,6 +4,7 @@ from api2ch.config import API_BASE from api2ch.models.base import Base from api2ch.models.post import Post +from api2ch.utils import clear_html, convert_html class Thread(Base): @@ -12,7 +13,21 @@ class Thread(Base): class ThreadWithStats(Thread): subject: str + + @property + def header(self): + return clear_html(self.subject) + comment: str + + @property + def body(self): + return convert_html(self.comment) + + @property + def body_text(self): + return clear_html(self.comment) + num: int @property