pyconversations.message.ChanPost¶
- class pyconversations.message.ChanPost(**kwargs)[source]¶
4chan post object with additional 4chan-specific features
- static clean_text(comment)[source]¶
Cleans the raw HTML of a cached 4chan post, returning both the references and teh comment itself
- Parameters
comment (str) – The raw text of a 4chan comment
- Returns
2-tuple(str, list(int)) – The comment text and a list of identified reference IDs
- static exclude_replies(comment)[source]¶
Function to remove quotes from a reply and return reference to the posts that were replied to
- Parameters
comment (str) – Text from 4chan comment
- Returns
2-tuple(str, list(int)) – The comment and the list of identified references
- static parse_datestr(x)[source]¶
Static method that specifies how to convert the native datetime string into a a Python datetime object.
- Parameters
x (str) – The raw datetime string
- Returns
datetime.datetime – Creation datetime of 4chan timestamp
- static parse_raw(data, lang_detect=False)[source]¶
Static method that must be implemented by all non-abstract child classes. Concrete implementations should specify how to parse the raw data into this object.
- Parameters
data (JSON/dict) – The raw data to be pre-processed.
lang_detect (bool) – A boolean which specifies whether language detection should be activated. (Default: False)
- Returns
ChanPost – The parsed post