2021-05-03 02:40:21 +04:00
|
|
|
from typing import Optional
|
2020-07-08 22:53:39 +04:00
|
|
|
|
2021-05-03 02:40:21 +04:00
|
|
|
from scrapthechan.parsers.tinyboardlike import TinyboardLikeParser
|
2020-07-08 22:53:39 +04:00
|
|
|
|
|
|
|
__all__ = ["FourChanParser"]
|
|
|
|
|
|
|
|
|
2021-05-03 02:40:21 +04:00
|
|
|
class FourChanParser(TinyboardLikeParser):
|
2020-07-08 22:53:39 +04:00
|
|
|
"""JSON parser for 4chan.org image board."""
|
|
|
|
|
|
|
|
def __init__(self, board: str, thread: str,
|
|
|
|
skip_posts: Optional[int] = None) -> None:
|
2021-05-03 02:40:21 +04:00
|
|
|
super().__init__(board, thread, skip_posts)
|
2020-07-08 22:53:39 +04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def imageboard(self) -> str:
|
|
|
|
return "4chan.org"
|
|
|
|
|
|
|
|
@property
|
2021-05-03 02:40:21 +04:00
|
|
|
def json_thread_url(self) -> str:
|
|
|
|
return "https://a.4cdn.org/{board}/thread/{thread}.json"
|
|
|
|
|
|
|
|
@property
|
|
|
|
def file_base_url(self) -> str:
|
|
|
|
return "https://i.4cdn.org/{board}/{filename}"
|