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

Storing objects in RAM

Francesco Poldi edited this page May 6, 2020 · 2 revisions

Here are showed examples about how to save data (tweets, users, ...) in lists (RAM)

Tweets

import twint

c = twint.Config()

c.Username = 'noneprivacy'
c.Limit = 20
c.Store_object = True

twint.run.Search(c)
tweets = twint.output.tweets_list

Or you can just specify which list to store tweets in:

import twint

tweets = []

c = twint.Config()

c.Username = 'noneprivacy'
c.Limit = 20
c.Store_object = True
c.Store_object_tweets_list = tweets

twint.run.Search(c)
# now 'tweets' contains the tweets
# twint.output.tweets_list` is empty

In both cases, tweets is a list.

Following/Followers

import twint

c = twint.Config()

c.Username = 'noneprivacy'
c.Limit = 20
c.Store_object = True

twint.run.Followers(c)
followers = twint.output.follows_list

Where twint.output.follows_list is a list

Users' info

import twint

c = twint.Config()

c.Username = 'noneprivacy'
c.Limit = 20
c.Store_object = True
c.User_full = True

twint.run.Followers(c)
users = twint.output.users_list
import twint

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

twint.run.Lookup(c)

user = twint.output.users_list[0]
print(user.join_date)

Here users is a list of twint.user.user class elements.