为Python/twitterapi脚本添加用户输入

2024-06-09 05:44:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在寻找一种用Python更新tweeplyapi请求的方法,允许用户输入一个位置和日期,以便能够从中进行搜索

我现在有一个情感分析工具,它允许用户输入一个搜索词,以及可以搜索的tweet数量

我正在寻找一种更新的方法,以便API请求查找用户位置,以及tweets发布的日期(我知道使用twitterapi只能返回7天)

以下是我的代码当前的外观:

searchTerm = input("Enter Keyword/Tag to search about: ")
NoOfTerms = int(input("Enter how many tweets to search: "))
self.tweets = tweepy.Cursor(api.search, q=searchTerm, lang="en").items(NoOfTerms)

Tags: 工具to方法用户apiinputsearch数量