python - 在 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 是可行的。
解决方案
推荐阅读
- javascript - Google Cloud App Engine 是否有特殊的 Node.js 运行时?
- maven - Maven 部署因冲突而失败
- django - Django CONN_MAX_AGE 设置为 0 但执行查询后连接保持打开状态
- signals - 如何使用 aiohttp 实现 SIGTERM 和 SIGINT 信号的回调
- android - 在android中花费大量时间(5秒)的自定义url的DNS查找
- java - 使用 Docusign API 获取 JWT 令牌时出现问题
- android - 如何在状态栏上显示变化的数字?
- machine-learning - 贝叶斯超参数优化
- jenkins-pipeline - 将文件暂存到 Jenkins Pipeline 中的多个位置
- amazon-web-services - IAM 策略对 S3 存储桶的权限被拒绝