Loading...

Twitter API with Python: Part 2 -- Cursor and Pagination

Twitter API with Python: Part 2 -- Cursor and Pagination
In this video, we will continue with our use of the Tweepy Python module and the code that we wrote from Part 1 of this series:
https://www.youtube.com/watch?v=wlnx-7cm4Gg

The goal of this video will be to understand how Tweepy handles pagination, that is, how can we use Tweepy to comb over the various pages of tweets? We will see how to accomplish this by making use of Tweepy's Cursor module. In doing so, we will be able to directly access tweets, followers, and other information directly from our own timeline. We will also continue to improve the code that we wrote from Part 1

Relevant Links:

Part 1:  https://www.youtube.com/watch?v=wlnx-7cm4Gg
Part 2: https://www.youtube.com/watch?v=rhBZqEWsZU4
Part 3: https://www.youtube.com/watch?v=WX0MDddgpA4
Part 4: https://www.youtube.com/watch?v=w9tAoscq3C4
Part 5: https://www.youtube.com/watch?v=pdnTPUFF4gA

Tweepy Website:
http://www.tweepy.org/

Cursor Docs:
http://docs.tweepy.org/en/v3.5.0/cursor_tutorial.html

API Reference:
http://docs.tweepy.org/en/v3.5.0/api.html

GitHub Code for this Video:
https://github.com/vprusso/youtube_tutorials/tree/master/twitter_python/part_2_cursors_and_pagination

My Website:
vprusso.github.io

This video is brought to you by DevMountain, a coding boot camp that offers in-person and online courses in a variety of subjects including web development, iOS development, user experience design, software quality assurance, and salesforce development. DevMountain also includes housing for full-time students.

For more information: 
https://devmountain.com/?utm_source=Lucid%20Programming

RRelated Posts

REST API concepts and examples

This video introduces the viewer to some API concepts by making example calls to Facebook's Graph API, Google Maps' API, Instagram's Media Search API, and Twitter's Status Update API. /**********

CComments

  • Layla Zhang
    Vinnie! Could you please do a series on Kafka with Python (potentially using this twitter streaming API as an example)? You are so good at explaining things and I'm having a hard time finding quality content on this particular subject on YouTube.
  • Ahmed Altarawenh
    can i get the user_id for every single tweet ? and the followers for this user ?
  • entelechy
    Great tutorial series! What about dealing with emojis and other unicode errors? Because the Status object isn't just a straight dictionary it's been hard to find a general solution for any Status as there are unicode errors popping up all throughout the object.
  • alawi0juventus
    great work bro, thank you for the time you put to make those videos.
  • Harrel Blatt
    This returns a list. I was hoping the returned object is son then we can access it with keys?
  • gonatrollya
    Hey man are you going to make more of these
  • Dividend Portfolio
    The git link in the description is error 404
  • Mark Wagoner
    When will the next video be available for how to sort through the tweet and clean it up? Great video. Very helpful
  • SGE Kids
    Not that I quite understand what they are doing, but I've read that Twitter is taking away cursor/page type functions with their updated API and the paid tiers. I've searched online for details about how this will affect Tweepy, but since the change hasn't officially happened yet, I don't know if anyone has addressed it.

    So, I guess my question is this: how will Tweepy be affected once the deprecations go through (in August)?


    And a follow up question: I use Tweepy as a Send Tweets bot (which I think I will be able to continue post change), but I also use it to get users, filter them, and then follow/unfollow/retweet and so forth … how will I perform these actions once certain functions are deprecated?


    Sorry if my questions are confusing.
  • Marco Marine
    So amazing tutorial, really you went through the API and explained everything in very concise and helpful way.
  • TROLLINGVOCADO
    if status==420

    NIOCE
  • Ryan
    Awesome tutorial! How would you live stream a specific user's tweets rather than pulling in recent tweets? Thanks! :)
  • abhijit singh
    hey thanks for the video, can you please tell how to dump this in MySQL database?
  • Pablo Viana
    Excellent video!