【问题标题】:getting most popular hashtags using twitter api使用 twitter api 获取最受欢迎的主题标签
【发布时间】:2013-12-10 12:07:48
【问题描述】:

我想从 twitter api 中检索前 10 个或前 20 个最受欢迎的主题标签。

我该怎么做,是否有任何直接的 api 或者我应该使用 twitter 搜索 api 收集大型数据集并手动收集流行的主题标签?

【问题讨论】:

    标签: twitter twitter-oauth twitter4j


    【解决方案1】:

    Twitter API 文档是here

    使用 Tweepy(推荐方法):

    import tweepy
    
    consumer_key ="PUT_YOUR_KEY"
    consumer_secret ="PUT_YOUR_KEY"
    access_token ="PUT_YOUR_KEY"
    access_token_secret ="PUT_YOUR_KEY"
    
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    api = tweepy.API(auth)
    tags = api.trends_place(23424848) # 23424848 Corresponds to the Yahoo ID for India. Change this to the location that you require.
    

    如果您没有安装 tweepy,请使用:

    pip install tweepy
    

    【讨论】:

      猜你喜欢
      • 2022-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-24
      • 1970-01-01
      • 2021-10-18
      • 2011-08-17
      • 2020-10-04
      相关资源
      最近更新 更多