how to take all tweets in a hashtag with tweepy?

后端 未结 4 506
余生分开走
余生分开走 2021-02-04 22:53

I\'m trying to take every open tweets in a hashtag but my code does not go further than 299 tweets.

I also trying to take tweets from a specific time line like tweets on

4条回答
  •  梦毁少年i
    2021-02-04 23:15

    Sorry, I can't answer in comment, too long. :)

    Sure :) Check this example: Advanced searched for #data keyword 2015 may - 2016 july Got this url: https://twitter.com/search?l=&q=%23data%20since%3A2015-05-01%20until%3A2016-07-31&src=typd

    session = requests.session()
    keyword = 'data'
    date1 = '2015-05-01'
    date2 = 2016-07-31
    session.get('https://twitter.com/search?l=&q=%23+keyword+%20since%3A+date1+%20until%3A+date2&src=typd', streaming = True)
    

    Now we have all the requested tweets, Probably you could have problems with 'pagination' Pagination url ->

    https://twitter.com/i/search/timeline?vertical=news&q=%23data%20since%3A2015-05-01%20until%3A2016-07-31&src=typd&include_available_features=1&include_entities=1&max_position=TWEET-759522481271078912-759538448860581892-BD1UO2FFu9QAAAAAAAAETAAAAAcAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&reset_error_state=false

    Probably you could put a random tweet id, or you can parse first, or requests some data from twitter. It can be done.

    Use Chrome's networking tab to find all the requested information :)

提交回复
热议问题