[英]Scrape subreddit post titles and use them as filename using Praw
[英]Can you use PRAW to find someone's first comment in a subreddit?
似乎無法獲取用戶通過PRAW訂閱subreddit的日期,但是是否可以獲取用戶在特定subreddit中的第一條評論?
我能想到的唯一方法是解析他的所有評論並過濾掉對該特定subreddit所做的評論。 然后,您可以基於comment.created_utc
對列表進行排序,並獲取最早的評論。
您可以解析用戶的所有評論,並過濾來自特定subreddit的評論,如下所示-
user = reddit.redditor('username')
target_subreddit = 'target_subreddit'
comment_list = []
# This iterates over all the comments made by the user
for comment in user.comments.new(limit=None):
# Check if a comment belongs to your target subreddit
if str(comment.subreddit) == target_subreddit:
comment_list.append(comment)
# Sort comment_list based on comment.created_utc to get the oldest comment
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.