首页 > 解决方案 > 在 GetOldTweets3 中指定语言?

问题描述

有没有办法在GetOldTweets3中指定检索内容的语言?

由于这本质上是一种网络抓取形式,因此文档并未指出语言选择,但也许有人有解决方法的想法?

此外,我在示例脚本中遇到了 HTTP 404 错误:

# Importing GetOldTweets3
import GetOldTweets3 as got
# Importing pandas
import pandas as pddef 

def my_tweets(hashtag, startdate, enddate, maxtweet):
    tweetCriteria = got.manager.TweetCriteria().setQuerySearch(hashtag)\
                                           .setSince(startdate)\
                                           .setUntil(enddate)\
                                           .setMaxTweets(maxtweet) # 0 = all possible tweets will be retrieved
    tweet = got.manager.TweetManager.getTweets(tweetCriteria)
    print(tweet.text)


my_tweets('#IWillGoOut', "2000-07-18", "2019-07-20", 0)

输出如下所示:

An error occured during an HTTP request: HTTP Error 404: Not Found
Try to open in browser: https://twitter.com/search?q=%23IWillGoOut%20since%3A2000-07-18%20until%3A2019-07-20&src=typd

An exception has occurred, use %tb to see the full traceback.

SystemExit

但是,在浏览器中打开生成的 URL 是可行的。

标签: pythontwitter

解决方案


推荐阅读