get_post_list

PyPtt.API.get_post_list(self, board: str, limit: int = 20, offset: int = 0) list[dict]

取得文章列表。

參數:
  • board (str) – 看板名稱。

  • limit (int) – 取得文章數量,預設為 20。

  • offset (int) – 偏移量,預設為 0。

回傳:

list[dict],文章列表,詳見 PostField

引發:

範例:

import PyPtt

ptt_bot = PyPtt.API()
try:
    # .. login ..
    post_list = ptt_bot.get_post_list(board='Python', limit=10, offset=0)
    # .. do something ..
finally:
    ptt_bot.logout()