Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Scraping functions

Francesco Poldi edited this page Aug 11, 2019 · 1 revision

Basically we can get users (and their information) and tweets. But there are various ways to get tweet and user objects.

Tweets

We can get tweets in three ways:

  • searching for them, twint.run.Search
  • scraping the user's timeline, twint.run.Profile
  • scraping the favorite tweets of an user, twint.run.Favorites

Users

We can get only the usernames about the followers/following of a specific user:

  • followers: twint.run.Followers
  • following: twint.run.Following

We can also get the information about the followers/following of a specific user, or even just the user itself:

  • followers/following, just add config.User_full = True
  • single user: twint.run.Lookup

Examples

Searching for tweets

import twint

c = twint.Config()
c.Username = "twitter"

twint.run.Search(c)

Followers

import twint

c = twint.Config()
c.Username = "twitter"

twint.run.Followers(c)

Followers and their information

import twint

c = twint.Config()
c.Username = "twitter"
c.User_full = True

twint.run.Followers(c)

Target's information

import twint

c = twint.Config()
c.Username = "twitter"

twint.run.Lookup(c)

Pro tip for shadow banned users

What is shadow banning? What can we do in such case?

An user might get shadow banned for various reasons. Whatever the reason is, what happens is that you will not be able to search for tweets sent by that user. This doesn't mean that the user is temporary suspended or permanently banned, so if we go to user the page we'll still be able to see his/her tweets. In situations like this one is suggested to use twint.run.Profile. It will not return many tweets, but as of now it's the best solution.

You will still be able to search for tweets sent to the user, and tweets that mention him/her.