TwDataTypes

This page contains all the Data Class

PROXY_TYPE_SOCKS4 = 1
PROXY_TYPE_SOCKS5 = 2
PROXY_TYPE_HTTP = 3

Proxy

class Proxy(host: str, port: int, proxy_type: int, username: str = None, password: str = None)
Arguments
host: str

Host of Proxy

port: int

Port of proxy

proxy_type: int

Type of Proxy

username(optional): str

Username required for authentication

password(optional): str

Password required for authentication

UserTweets

class UserTweets

Bases : BaseGeneratorClass

Reference:

tweety.types.usertweet.UserTweets

Attributes:
tweets: list[Tweet | SelfThread]

List of User Tweets

get_replies: bool

Either to get replies or Not

user_id: int

User ID of the user in question

Methods:
to_xlsx(filename=None)

Export the User Tweets to Excel

Arguments:
filename(optional): str = None

Filename of Excel Workbook

Return: None

UserMedia

class UserMedia

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.usertweet.UserMedia

Attributes:
tweets: list[Tweet | SelfThread]

List of User Tweets

user_id: int

User ID of the user in question

SelfTimeline

class SelfTimeline

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.usertweet.SelfTimeline

Attributes:
tweets: list[Tweet | SelfThread]

List of User Tweets

timeline_type: str

Type of Timeline

user_id: int

User ID of the user in question

TweetComments

class TweetComments

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.usertweet.TweetComments

Attributes:
tweets: list[ConversationThread]

List of Tweet ConversationThreads

tweet_id: str

ID of Tweet

get_hidden: bool

Got hidden comments or not

TopicTweets

class TopicTweets

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.topic.TopicTweets

Attributes:
tweets: list[Tweet]

List of Tweets

TweetLikes

class TweetLikes

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.likes.TweetLikes

Attributes:
users: list[User]

List of Users

user_id: int

User ID of the user in question

TweetRetweets

class TweetRetweets

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.likes.TweetRetweets

Attributes:
users: list[User]

List of Users

user_id: int

User ID of the user in question

Mention

class Mention

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.mentions.Mention

Attributes:
tweets: list

List of User Tweets

user_id: int

User ID of the user in question

Bookmarks

class Bookmarks

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.bookmarks.Bookmarks

Attributes:
tweets: list

List of User Tweets

user_id: int

User ID of the user in question

CommunityTweets

class CommunityTweets

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.community.CommunityTweets

Attributes:
tweets: list[Tweet | SelfThread]

List of Tweets

filter: str | None

Any Filter which is begin applied

Methods:
to_xlsx(filename=None)

Export the User Tweets to Excel

Arguments:
filename(optional): str = None

Filename of Excel Workbook

Return: None

CommunityMembers

class CommunityMembers

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.community.CommunityMembers

Attributes:
users: list[User]

List of User

filter: str | None

Any Filter which is begin applied

Lists

class Lists

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.lists.Lists

Attributes:
lists: list[TwList]

List of Twitter List

ListMembers

class ListMembers

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.lists.ListMembers

Attributes:
users: list[User]

Users of Twitter List

ListTweets

class ListTweets

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.lists.ListTweets

Attributes:
tweets: list[Tweet | SelfThread]

Tweets of the List

UserFollowers

class UserFollowers

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.follow.UserFollowers

Attributes:
users: list[User]

Users List

UserFollowings

class UserFollowings

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.follow.UserFollowings

Attributes:
users: list[User]

Users List

MutualFollowers

class MutualFollowers

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.follow.MutualFollowers

Attributes:
users: list[User]

Users List

BlockedUsers

class BlockedUsers

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.follow.BlockedUsers

Attributes:
users: list[User]

Users List

TweetNotifications

class TweetNotifications

Bases : BaseGeneratorClass

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.notification.TweetNotifications

Attributes:
tweets: list[Tweet]

List of tweets

Inbox

class Inbox

Bases : dict

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.inbox.Inbox

Attributes:
conversations: list[Conversation]

List of User Conversation

messages: list[Message]

List of User Message

cursor: str

Pagination cursor to get new message

Methods:
get_conversation(conversation_id)

Get conversation of with specific User using its conversation id

Arguments:
conversation_id: str

Conversation id of the specific user

Return: Conversation | None

SelfThread

class SelfThread

Bases : dict

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.twDataTypes.SelfThread

Attributes:
tweets: list[Tweet]

List of Threaded Tweets

all_tweets_id: list[str]

List of all tweet ids in the thread

Methods:
expand()

Try getting all the tweets of the thread (by default Twitter returns only 3 Tweets from Thread)

ConversationThread

class ConversationThread

Bases : dict

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.twDataTypes.ConversationThread

Attributes:
tweets: list[Tweet]

List of Threaded Tweets

parent: Tweet

Parnet Tweet

Methods:
expand()

Try getting all the tweets of the thread (by default Twitter returns only 2 Tweets from Thread)

Tweet

class Tweet

Bases : dict

Note

This Object is JSON Serializable and Iterable

Reference:

tweety.types.twDataTypes.Tweet

Attributes:
id: int

ID of the Tweet

created_on: datetime.datetime

DateTime at which the Tweet was created

date: datetime.datetime

DateTime at which the Tweet was created

text: str

Text of the Tweet

rich_text: RichText

Text of the Tweet

author: User

Author of the Tweet

is_retweet: bool

Is this Tweet a retweet or not

retweeted_tweet: Tweet

Retweeted Tweet if is_retweet is True

is_quoted: bool

Is the Tweet quoted or not

quoted_tweet: Tweet

Quoted Tweet if is_quoted is True

is_reply: bool

Is this Tweet replied in response of any other Tweet

is_sensitive: bool

Does the Tweet contain sensitive content

reply_counts: int

Number of Times someone replied to this Tweet

quote_counts: int

Number of Times this Tweet was Quoted

replied_to: Tweet | str

Tweet this Tweet was sent in response to or USER ID

bookmark_count: int

Number of Times this Tweet was Bookmarked

views: int

Number of Times this Tweet was Viewed

likes: int

Number of Times this Tweet was Liked

language: str

Language of the Tweet (identified by Twitter)

place: Place

Any Place mentioned in the Tweet

retweet_counts: int

Number of Times this Tweet was Retweeted

source: str

Source of Tweet

has_moderated_replies: bool

Are replies on this Tweet moderated

is_liked: bool

is this tweet liked by authenticated user

is_retweeted: bool

is this tweet retweeted by authenticated user

can_reply: bool

can authenticated user reply to this Tweet

broadcast: Broadcast | None

Broadcast

edit_control: EditControl | None

Edit Control of the Tweet

has_newer_version: bool

Do this Tweet was edited and has newer version

audio_space_id: str

Id of the Audio Space in the Tweet

pool: Pool | None

Pool in the Tweet

community: Community | None

Community this tweet is part of

media: list[Media]

Media of the Tweet

user_mentions: list[ShortUser]

Users mentioned in the Tweet

urls: list[URL]

URLs mentioned in the Tweet

hashtags: list[Hashtag]

Hashtags mentioned in the Tweet

symbols: list[Symbol]

Symbols mentioned in the Tweet

community_note: str | None

Community Note posted in response to the Tweet

url: str

URL of the Tweet

threads: list[Tweet]

List of Threaded Tweets

comments: list[ConversationThread]

List of Comments sent in response to this Tweet

Methods:
get_comments(pages=1, wait_time=2, cursor=None)
iter_comments(pages=1, wait_time=2, cursor=None)

Get the comments / replies posted in response to this tweet

Arguments:
pages(optional): int = 1

How many pages to get

wait_time(optional): int = 2

Number of seconds to wait between multiple requests

cursor(optional): str = None

Pagination cursor to get the comments from that cursor up-to

Return: list[Tweet]
like()

Like the Tweet

Return: Bool
unlike()

Un-Like the Tweet

Return: Bool
translate()

Translate the Tweet

Return: TweetTranslate
delete()

Delete the Tweet

Return: Bool
download_all_media(progress_callback: Callable[[str, int, int], None] = None)

Download All Media from Tweet

progress_callback(optional): Callable[[str, int, int], None] = None

Callback function which will called while downloading to track the progress. [filename, total_size_in_bytes, downloaded_in_bytes]

retweet()

Retweet the Tweet

Return: Bool
get_reply_to()

Get the Tweet to which this Tweet was sent in reply

Return: Tweet

Media

class Media

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Media

Attributes:
id: str

Internal ID of the Media

display_url: str

Short Display URL of Media (This will open the Twitter website)

expanded_url: str

Full Display URL of Media (This will open the Twitter website)

media_url_https: str

Direct Link to the Media (thumbnail if media is Video)

type: str

Type of Media (video | photo)

url: str

Short URL of Tweet

streams: list[Stream]

List of streams available if the type is video

mediaStats: dict

Stats of the media , usually viewCount

source_user: User | None

Source from where the Media was posted

Methods:
download(filename: str = None, progress_callback: Callable[[str, int, int], None] = None)

Download the Media

Arguments:
filename(optional): str = None

Filename of the Media

progress_callback(optional): Callable[[str, int, int], None] = None

Callback function which will called while downloading to track the progress. [filename, total_size_in_bytes, downloaded_in_bytes]

Return: filename | None
best_stream()

Get Best available Media/Stream

Return: Media | Stream | None

Stream

class Stream

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Stream

Attributes:
bitrate: int

bitrate of stream audio

content_type: str

Mime-type of the Media

url: str

Direct URL to Stream

length: int

Length of stream in mini-seconds

aspect_ratio: list[int, int]

Aspect Ratio of the Stream

res: str

Resolution of the Stream

Methods:
download(filename: str = None, progress_callback: Callable[[str, int, int], None] = None)

Download the Media

Arguments:
filename(optional): str = None

Filename of the Media

progress_callback(optional): Callable[[str, int, int], None] = None

Callback function which will called while downloading to track the progress. [filename, total_size_in_bytes, downloaded_in_bytes]

Return: filename | None

ShortUser

class ShortUser

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.ShortUser

Attributes:
id: str

id of the User

name: str

Name of the User

screen_name: str

Username of the User

username: str

Username of the User

Card

class Card

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Card

Attributes:
rest_id: int

Id of the card

name: str

Name of the card

choices: list[Choice]

Number of Tweets this trend has till now

end_time: datetime.datetime

End Time of the Pool

last_updated_time: datetime.datetime

Last Updated Time of the Pool

duration: str

Duration of Pool in Minutes

user_ref: list[User]

Users Referred in the Pool

Choice

class Choice

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Choice

Attributes:
id: str

Id of the pool

name: str

Name of the choice

value: str

Value of the choice

key: str

Key of the choice

counts: str

Number of the votes this value has

Place

class Place

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Place

Attributes:
name: str

Name of the place

id: str

Id of the place

country: str

Country of the place

full_name: str

Full Name of the place

country_code: str

Country Code of the place

url: str

URL of the place

coordinates: list[Coordinates]

Coordinates of the place

Coordinates

class Coordinates

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Coordinates

Attributes:
latitude: float

Latitude Value of the place

longitude: float

Longitude Value of the place

User

class User

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.User

Attributes:
id: int

Id of the User

rest_id: int

Id of the User

created_at: datetime.datetime

DateTime at which the user was created

date: datetime.datetime

DateTime at which the Tweet was created

description: str

Bio / Description on User Profile

bio: str

Bio / Description on User Profile

can_dm: bool

Can the authenticated user send dm to this user

is_blocked: bool

Is the user blocked by authenticated user

entities: dict | None

Additional entities of user, usually links

fast_followers_count: int

Number of Fast Followers this user has

favourites_count: int

Number of Favourite this user has received

followers_count: int

Number of followers this user has

friends_count: int

Number of friends this user has

listed_count: int

Number of lists this user has

location: str | None

Location of the User

media_count: int

Number of Media this user has posted

name: str

Name of the User

normal_followers_count: int

Number of normal followers count this user has

profile_banner_url: str

Direct URL to the User banner image

profile_image_url_https: str

Direct URL to the User profile image

protected: bool

Is user private or not

screen_name: str

Username of the user

username: str

Username of the user

statuses_count: int

Number of status this user has posted

verified: bool

Is user verified or not.

possibly_sensitive: bool

Is the user known for posting sensitive content

pinned_tweets: list[str] | None

List of id of tweets pinned by the user

notifications_enabled: bool

Is new tweet notification enabled for this user

notifications: bool

Is new tweet notification enabled for this user

community_role: str | None

Role in Community (if applicable)

Methods:
follow()

Follow the User

Return: User
unfollow()

un-Follow the User

Return: User
enable_notifications()

Enable new Tweet notification for this user

Return: bool
disable_notifications()

Disable new Tweet notification for this user

Return: bool

Conversation

class Conversation

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.inbox.Conversation

Attributes:
id: int

Id of the conversation

name: str

Name of conversation

low_quality: bool

Is the conversation low quality

muted: bool

Is this conversation muted

notifications_disabled: bool

Is the notifications for this conversation disabled

nsfw: bool

Is this conversation not suitable for work

read_only: bool

Is this conversation read only

trusted: bool

Is this conversation trusted by the user

is_group: bool

Is this conversation a Group or Not

type: str

Type of conversation (GROUP_DM, ONE_TO_ONE)

participants: list[User]

Participants of the conversation

messages: list[Message]

Messages of the conversation

Methods:
get_all_messages(wait_time: int = 2, cursor: int = 0, till_date: datetime.datetime = None, count: int = None)
iter_all_messages(wait_time: int = 2, cursor: int = 0, till_date: datetime.datetime = None, count: int = None)

Force get all the messages of the conversation (iter for Generator)

Arguments:
wait_time: int | tuple[int, int]

Number of seconds to wait between multiple requests

cursor: str

Cursor of that specific Page

till_date: datetime.datetime

Get Messages till that date

count: int

Get this number of Messages

Return: list[Message]
send_message(text)

Send Message in this conversation

Arguments:
text: str

Content of the message to send

file: str | PathLike

File to send with message

Return: Message

Message

class Message

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.inbox.Message

Attributes:
id: int

Id of the message

conversation_id: str

Id of the conversation this message belongs to

epoch_time: int

Epoch Time at which the message was sent

time: datetime.datetime

Time at which the message was sent

request_id: str

Request ID of the message

text: str

Text of the message

receiver: User

The receiver of this message

sender: User

The sender of this message

media: Media | None

Media in the message

NewMessage

class NewMessage

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.events.newmessage.NewMessageUpdate.NewMessage

Attributes:
id: int

Id of the message

conversation_id: str

Id of the conversation this message belongs to

time: datetime.datetime

Time at which the message was sent

text: str

Text of the message

participants: list[User]

Participants of the conversation

receiver: User

The receiver of this message

sender: User

The sender of this message

media: Media | None

Media in the message

message: Message

Actual message object

conversation: Conversation

Conversation object

Methods:
respond(text)

Send Message in this conversation

Arguments:
text: str

Content of the message to send

Return: Message

Community

class Community

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Community

Attributes:
id: int

Id of the Community

created_at: datetime.datetime

DateTime at which the Community was created

date: datetime.datetime

DateTime at which the Tweet was created

description: str

Bio / Description on Community

name: str

Name of the Community

role: str

Role of authenticated user in the community

member_count: int

Number of Members in the Community

moderator_count: int

Number of Moderator in the Community

admin: list[User]

List of Admins of the community

creator: list[User]

List of Creators of the community

rules: list[str]

List of rules of the Community

Symbol

class Symbol

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Symbol

Attributes:
indices: list[int, int]

The start index of this symbol in the text

text: str

Actual Symbol

Hashtag

class Hashtag

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Hashtag

Attributes:
indices: list[int, int]

The start index of this hashtag in the text

text: str

Actual hashtag

URL

class URL

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.URL

Attributes:
indices: list[int, int]

The start index of this url in the text

display_url: str

Twitter Short URL

expanded_url: str

Actual Url

RichText

class RichText

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.RichText

Attributes:
id: int

Id of the Tweet

text: str

Text of the tweet

hashtags: list[Hashtag]

List of hashtags in the Tweet

urls: list[URL]

List of URLs in the Tweet

symbols: list[Symbol]

List of Symbols in the Tweet

user_mentions: list[ShortUser]

List of Users mentioned in the Tweet

media: list[Media]

List of Media in the Tweet

tags: list[RichTag]

List of rich text tags in the text

Methods:
get_html()

Get HTML version of the text which includes all the tags and elements

Return: str

RichTag

class RichTag

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.RichTag

Attributes:
from_index: int

The start index of this specific tag in the text

to_index: int

The end index of this specific tag in the text

hashtags: list[str]

List of hashtags in the Tweet

types: list[str]

Type of tags included in the range

Pool

class Pool

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Pool

Attributes:
id: str

Id of the Pool

name: str

Name of the Pool

choices: list[Choice]

List of choices in teh Tweet

end_time: datetime.datetime

End Time of the Pool

last_updated_time: datetime.datetime

Last Updated Time of the Pool

duration: str

Duration of Pool in Minutes

user_ref: list[User]

Users Referred in the Pool

selected_choice: Choice | None

Choice already selected by the authenticated user

is_final: bool

Has pool ended or not

TwList

class TwList

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.TwList

Attributes:
id: str

Id of the List

name: str

Name of the List

created_at: datetime.datetime

Time at which list was created

description: str

Description of List

is_member: bool

is the authenticated member of this list

member_count: int

Number of member List has

subscriber_count: int

Number of subscriber List has

admin: User

Admin of the List

EditControl

class EditControl

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.EditControl

Attributes:
tweet_ids: list[str]

List of Tweet ids

edits_remaining: str

Number of Edits Remaining for this Tweet

is_latest: bool

is this the Latest version of Tweet

latest_tweet_id: str

ID of latest edited Tweet

Broadcast

class Broadcast

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Broadcast

Attributes:
id: int

ID of Broadcast

width: str

Width of Broadcast

title: str

Title of Broadcast

Topic

class Topic

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.Topic

Attributes:
id: int

ID of Topic

description: str

description of topic

name: str

Title of Topic

is_following: bool

is authenticated user following the topic

TweetTranslate

class TweetTranslate

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.TweetTranslate

Attributes:
id: int

ID of Tweet

translation: str

translated tweet of Tweet

text: str

translated tweet of Tweet

source_language: str

Source Language of Tweet

destination_language: str

Tweet translated of this Language

TweetAnalytics

class TweetAnalytics

Bases : dict

Note

This Object is JSON Serializable

Reference:

tweety.types.twDataTypes.TweetAnalytics

Attributes:
expands: int

Number of Expands

engagements: int

Number of Engagements

follows: int

Number of Follows

impressions: int

Number of Impressions

Number of Clicks

profile_visits: int

Number of Profile Visits

cost_per_follower: int

Cost Incurred per Follower