1

我正在使用 Python 中的 TwitterAPI 使用一些关键字访问 Twitter 上的完整推文存档。我在文档中读到,我可以使用 place_country 和国家代码指定位置,但由于某种原因,它不会只返回那个国家的结果。如何从按国家/地区过滤的完整档案中获取推文?

from TwitterAPI import TwitterAPI

r = api.request("tweets/search/fullarchive/:cs",
{"query":"Corona place_country:DE", 
"maxResults": "100", 
"fromDate":"201908230000", 
"toDate":"202004300000"})
4

2 回答 2

0

I don't think it's possible this way, place_country is not a field that you can use from the standard search api (https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets).

You can probably use "geocode" with a large "radius" and "lang" parameter.

于 2020-05-12T14:00:48.877 回答
0

当您过滤时,place_country您正在过滤在其有效负载中具有特定国家代码的推文。此代码由用户设置,并不保证推文是在特定国家/地区创作的。您可以在过滤器中包含其他运算符,它们可能会给您带来更好的结果。https://developer.twitter.com/en/docs/tutorials/filtering-tweets-by-location

但是,您要实现的目标是有问题的,因为默认情况下位置已关闭,并且大多数用户都没有打开它。

于 2020-05-12T14:09:34.620 回答