【问题标题】:How do i add date limits to twitter sentiment analysis code? (Example : 1/9/2021 to 7/9/2021)如何为 Twitter 情绪分析代码添加日期限制? (例如:2021 年 1 月 9 日至 2021 年 7 月 9 日)
【发布时间】:2021-11-03 15:57:38
【问题描述】:

这是一个sn-p的代码:

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

【问题讨论】:

    标签: python twitter sentiment-analysis


    【解决方案1】:

    您的问题不是关于情绪分析,而是关于使用tweepy API。所以你应该查看它的文档。

    这可能会对您有所帮助:https://docs.tweepy.org/en/latest/client.html?highlight=query#search-tweets

    Client.search_all_tweets 有参数start_timeend_time,这可能就是你要找的。​​p>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-09
      • 2021-09-15
      • 1970-01-01
      • 1970-01-01
      • 2022-10-14
      • 1970-01-01
      • 2019-11-23
      • 2021-04-29
      相关资源
      最近更新 更多