gpt4 book ai didi

python - Twitter Trends 地方返回不同城市的相同趋势?

转载 作者:太空宇宙 更新时间:2023-11-03 10:55:12 25 4
gpt4 key购买 nike

我正在尝试在 python 中获取德国不同城市的主题标签。所以首先我得到可用的趋势:

twitter.trends.available(_woeid=23424829)

然后从这里我得到每个地方的趋势:

for trend in germany_trends:
twitter.trends.place(_id=trend['woeid'])[0]['trends']

之后,我过滤结果,让每个城市的推文具有最高的 tweet_volume。问题是:每个城市的标签都是一样的。我从“可用趋势”中得到了 10 个不同的城市,但主题标签有 90% 是相同的。

当我查看这样的 map 时 https://www.trendsmap.com/ ,我想知道我做错了什么。他们在所有这些城市都有许多单独的标签。

一个示例响应,您可以明白我的意思,主题标签几乎相同,“最佳”主题标签也相同:

"DE, Stuttgart": [
{
"url": "http://twitter.com/search?q=%23ISIS",
"query": "%23ISIS",
"tweet_volume": 21646,
"name": "#ISIS",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%22Hans+Rosling%22",
"query": "%22Hans+Rosling%22",
"tweet_volume": 44855,
"name": "Hans Rosling",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%22Betsy+DeVos%22",
"query": "%22Betsy+DeVos%22",
"tweet_volume": 664741,
"name": "Betsy DeVos",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=Nioh",
"query": "Nioh",
"tweet_volume": 24160,
"name": "Nioh",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%23FCBWOB",
"query": "%23FCBWOB",
"tweet_volume": 14216,
"name": "#FCBWOB",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%23sid2017",
"query": "%23sid2017",
"tweet_volume": 28277,
"name": "#sid2017",
"promoted_content": null
}
],
"DE, Dresden": [
{
"url": "http://twitter.com/search?q=%22Hans+Rosling%22",
"query": "%22Hans+Rosling%22",
"tweet_volume": 44855,
"name": "Hans Rosling",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%22Betsy+DeVos%22",
"query": "%22Betsy+DeVos%22",
"tweet_volume": 664741,
"name": "Betsy DeVos",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=Nioh",
"query": "Nioh",
"tweet_volume": 24160,
"name": "Nioh",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%23FCBWOB",
"query": "%23FCBWOB",
"tweet_volume": 14216,
"name": "#FCBWOB",
"promoted_content": null
},
{
"url": "http://twitter.com/search?q=%23sid2017",
"query": "%23sid2017",
"tweet_volume": 28277,
"name": "#sid2017",
"promoted_content": null
}
],

最佳答案

https://www.trendsmap.com/ 中,我得到了不同城市几乎相同的标签。因为大多数城市都有相同的高趋势。但是如果你想要独特的高趋势,那么你必须忽略大多数城市的共同高趋势,并且必须选择第二高的 twitter trend for india 。可以取不同城市的高趋势字典,重复多少次(count) {'trend':count} like {'#sid2017':2,'#FCBWOB' :2} 并保留每个城市的前 2-3 个热门趋势,以获得每个城市独特的热门趋势。

关于python - Twitter Trends 地方返回不同城市的相同趋势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42118074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com