basc_py4chan.Thread – 4chan Threads

basc_py4chan.Thread allows for standard access to a 4chan thread, including listing all the posts in the thread, information such as whether the thread is locked and stickied, and lists of attached file URLs or thumbnails.

Basic Usage

class basc_py4chan.Thread(board, id)[source]

Represents a 4chan thread.

closed

bool – Whether the thread has been closed.

sticky

bool – Whether this thread is a ‘sticky’.

archived

bool – Whether the thread has been archived.

bumplimit

bool – Whether the thread has hit the bump limit.

imagelimit

bool – Whether the thread has hit the image limit.

custom_spoiler

int – Number of custom spoilers in the thread (if the board supports it)

topic

basc_py4chan.Post – Topic post of the thread, the OP.

posts

list of basc_py4chan.Post – List of all posts in the thread, including the OP.

all_posts

list of basc_py4chan.Post – List of all posts in the thread, including the OP and any omitted posts.

url

string – URL of the thread, not including semantic slug.

semantic_url

string – URL of the thread, with the semantic slug.

semantic_slug

string – The ‘pretty URL slug’ assigned to this thread by 4chan.

Methods

Thread objects are not instantiated directly, but instead through the appropriate basc_py4chan.Board methods such as basc_py4chan.Board.get_thread().

Thread.files()[source]

Returns the URLs of all files attached to posts in the thread.

Thread.thumbs()[source]

Returns the URLs of all thumbnails in the thread.

Thread.filenames()[source]

Returns the filenames of all files attached to posts in the thread.

Thread.thumbnames()[source]

Returns the filenames of all thumbnails in the thread.

Thread.update(force=False)[source]

Fetch new posts from the server.

Parameters:force (bool) – Force a thread update, even if thread has 404’d.
Returns:How many new posts have been fetched.
Return type:int
Thread.expand()[source]

If there are omitted posts, update to include all posts.