Advertisement
yehchge

PyPtt 驗證推文

Jun 10th, 2025
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1.  
  2. def verify(PTTBot, BoardKey, ID, Aid, Content):
  3.     # 驗證推文
  4.     # 取得文章資訊
  5.     post_info = PTTBot.get_post(BoardKey, aid=Aid)
  6.  
  7.     # 檢查推文列表
  8.     if post_info:
  9.         comments = post_info['comments']
  10.         for comment in comments:
  11.             # print(comment['author'], comment['content'])
  12.             if comment['author'] == ID and comment['content'] == Content:
  13.                 return 'ok'
  14.  
  15.  
  16.     return None;
  17.  
Tags: Code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement