这是一个dcard api包装器
pydcard的Python项目详细描述
这是一个dcard api包装器
概述
pydcard是用于访问dcard api的python包装器。
pydcard仅在python 3中支持
用法
基本用法
import pydcard from pprint import pprint # Get top posts in *all* forum from Dcard. The parameter is page number. page_one = pydcard.get_all_top_posts(1) # Each page have 20 threads, now get the id in index 0. # i.e. the first thread's id. th_one_id = page_one[0].get('id') # Using thread id to get the post content pprint((pydcard.get_post(th_one_id)))
复杂的示例(需要安装prettytable包)
DCARD_术语
API
get_post(post_id)
按邮件ID获取邮件内容。
get_all_to p_posts(to_page_num)
从all论坛获取热门帖子。从第1页到第页 to_page_num。
get_all_new_posts(to_page_num)
正在从all论坛获取最近的帖子。从第1页到第页 to_page_num。
get_all_page(page_num)
从all论坛获取最近的帖子,仅一页。