1
0
ScrapTheChan/scrapthechan/parsers/fourchan.py

26 lines
620 B
Python

from typing import Optional
from scrapthechan.parsers.tinyboardlike import TinyboardLikeParser
__all__ = ["FourChanParser"]
class FourChanParser(TinyboardLikeParser):
"""JSON parser for 4chan.org image board."""
def __init__(self, board: str, thread: str,
skip_posts: Optional[int] = None) -> None:
super().__init__(board, thread, skip_posts)
@property
def imageboard(self) -> str:
return "4chan.org"
@property
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}"