All Available Functions

This page contains all the public method available to work with

Attention

All methods requires user to be authenticated

Attention

All methods are async supported

Attention

All method’s examples assumes app is authenticated instance of TwitterAsync

Get User Info

  • async TwitterAsync.get_user_info(username: str | int | list = None)

    Get the User Info of the specified username

    Arguments
    username(optional): str = None

    Username, User ID or List of User IDs of the user you want to get info of.

    Return
    Returns:

    User | list[User]

    user = await app.get_user_info('elonmusk')
    

Get User ID

  • async TwitterAsync.get_user_id(username: str)

    Get User ID of a specific Username

    Tip

    (in case you only want User ID, you must be using this method)

    Arguments
    username: str

    Username of the user you want to get ID of.

    Return
    Returns:

    str

    user = await app.get_user_id('elonmusk')
    

Get User Tweets

  • async TwitterAsync.get_tweets(username: str | int | User, pages: int = 1, replies: bool = False, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_tweets(username: str | int | User, pages: int = 1, replies: bool = False, wait_time: int = 2, cursor: str = None)

    Get the Tweets of the specified username (iter for generator)

    Arguments
    username: str

    Username of the user you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    replies(optional): bool = False

    Fetch the Replied Tweets of the User

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserTweets

    Returns:

    Generator : (UserTweets , list[Tweet])

    tweets = await app.get_tweets('elonmusk')
    for tweet in tweets:
        print(tweet)
    

Get User Medias

  • async TwitterAsync.get_user_media(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_user_media(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the User Media of the specified username (iter for generator)

    Arguments
    username: str

    Username of the user you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserMedia

    Returns:

    Generator : (UserMedia , list[Tweet])

    tweets = await app.get_user_media('elonmusk')
    for tweet in tweets:
        print(tweet.media)
    

Get User Highlights

  • async TwitterAsync.get_user_highlights(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_user_highlights(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the User Highlights of the specified username (iter for generator)

    Arguments
    username: str

    Username of the user you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserHighlights

    Returns:

    Generator : (UserHighlights , list[Tweet])

    tweets = await app.get_user_highlights('elonmusk')
    for tweet in tweets:
        print(tweet)
    

Searching a Keyword

  • async TwitterAsync.search(keyword: str, pages: int = 1, filter_: str = None, wait_time: int = 2, cursor: str = None)
  • Search for a keyword or hashtag on Twitter (iter for generator)

    Arguments
    keyword(Required): str

    The keyword which is supposed to be searched

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    filter_(optional): str = None

    Filter you would like to apply on the search. More about Search Filters

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    Search

    Returns:

    Generator: (Search, list[Tweet])

    tweets = await app.search('elonmusk')
    for tweet in tweets:
        print(tweet)
    

Get a Tweet Detail

  • async TwitterAsync.tweet_detail(identifier: str)

    Search for a keyword or hashtag on Twitter

    Arguments
    identifier: str

    Either ID of the Tweet of URL of the Tweet you want to detail of.

    Return
    Returns:

    Tweet

    tweet = await app.tweet_detail("https://twitter.com/Microsoft/status/1442542812197801985")
    

Getting Home Timeline

  • async TwitterAsync.get_home_timeline(timeline_type: str = 'HomeTimeline', pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_home_timeline(timeline_type: str = 'HomeTimeline', pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Tweets from Home Page of Authenticated User (iter for generator)

    Arguments
    timeline_type(optional): str = "HomeTimeline"

    The type of Timeline to Get (“HomeTimeline”, “HomeLatestTimeline”)

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    SelfTimeline

    Returns:

    Generator: (SelfTimeline, list[Tweet])

    from tweety.types import HOME_TIMELINE_TYPE_FOR_YOU, HOME_TIMELINE_TYPE_FOLLOWING
    
    ...
    
    tweets = await app.get_home_timeline(timeline_type=HOME_TIMELINE_TYPE_FOR_YOU)
    for tweet in tweets:
        print(tweet)
    

Getting Tweet Likes

  • async TwitterAsync.get_tweet_likes(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_tweet_likes(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Users who have Likes of Tweet (iter for generator)

    Arguments
    tweet_id: str | Tweet = 1

    ID of the Tweet

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    TweetLikes

    Returns:

    Generator: (TweetLikes, list[Tweet])

    tweet = await app.tweet_detail("1232515235253352")
    likes = await app.get_tweet_likes(tweet)
    for like in likes:
        print(like)
    

Getting Tweet Retweets

  • async TwitterAsync.get_tweet_retweets(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_tweet_retweets(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Users who have Retweeted the Tweet (iter for generator)

    Arguments
    tweet_id: str | Tweet = 1

    ID of the Tweet

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    TweetRetweets

    Returns:

    Generator: (TweetRetweets, list[User])

    tweet = await app.tweet_detail("1232515235253352")
    users = await app.get_tweet_retweets(tweet)
    for user in users:
        print(user)
    

Getting Tweet Quotes

  • async TwitterAsync.get_tweet_quotes(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_tweet_quotes(tweet_id: str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Users who have Quoted the Tweet (iter for generator)

    Arguments
    tweet_id: str | Tweet = 1

    ID of the Tweet

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    Search

    Returns:

    Generator: (Search, list[User])

    tweet = await app.tweet_detail("1232515235253352")
    users = await app.get_tweet_quotes(tweet)
    for user in users:
        print(user)
    

Getting Mentioned Tweets

  • async TwitterAsync.get_mentions(pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_mentions(pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Tweets in which the authenticated user is mentioned (iter for generator)

    Arguments
    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    Mention

    Returns:

    Generator: (Mention, list[Tweet])

    tweets = await app.get_mentions()
    for tweet in tweets:
        print(tweet)
    

Getting Bookmarks

  • async TwitterAsync.get_bookmarks(pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_bookmarks(pages: int = 1, wait_time: int = 2, cursor: str = None)

    Getting the Bookmarked Tweets of authenticated user (iter for generator)

    Arguments
    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    Bookmarks

    Returns:

    Generator: (Bookmarks, list[Tweet])

    tweets = await app.get_bookmarks()
    for tweet in tweets:
        print(tweet)
    

Getting Inbox

  • async TwitterAsync.get_inbox(user_id: int | str | User = None, pages: int = 1, wait_time: int = 2)
  • async TwitterAsync.iter_inbox(user_id: int | str | User = None, pages: int = 1, wait_time: int = 2)

    Getting the inbox of authenticated user (iter for generator)

    Arguments
    user_id(optional): int | str | User = None

    User ID of the user whom to get the conversation of (coming soon)

    pages(optional): int = 1

    Number of Inbox Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    Return
    Returns:

    Inbox

    inbox = await app.get_inbox()
    for conversation in inbox:
        print(conversation)
    

Get a Conversation

  • async TwitterAsync.get_conversation(conversation_id: int | str | Conversation | User, max_id=None)

    Sending Message to a User

    Arguments
    conversation_id: int | str | Conversation | User

    ID of the conversation

    max_id: str

    Max ID from upto which the messages will be ignored in the conversation

    Return
    Returns:

    Conversation

    message = await app.get_conversation("kharltayyab")
    

Sending Message

  • async TwitterAsync.send_message(username: str | int | User, text: str, file: str | UploadedMedia = None, in_group: bool = False, reply_to_message_id: int | str | Message = None, audio_only: bool = False, quote_tweet_id: str | int | Tweet = None)

    Sending Message to a User

    Arguments
    username: int | str | User

    Username of User ID of the user whom to send the message

    text: str

    Content of the message to be sent

    file: str

    Filepath of the file to be sent

    in_group: bool

    Either Message is begin sent in group or not

    reply_to_message_id: int | str | Message

    Reply to which message id

    audio_only: bool

    Send media in message as audio only

    quote_tweet_id: int | str | Tweet

    Quote a specific tweet in your message

    Return
    Returns:

    Message

    message = await app.send_message("user", "Hi")
    

Sending Message Reaction

  • async TwitterAsync.send_message_reaction(reaction_emoji: str, message_id: str | int | Message, conversation_id: str | int | User | Conversation = None)

    Sending Message to a User

    Arguments
    reaction_emoji: str

    Emoji to react with

    message_id: str | int | Message

    ID of the Message to which reaction will be sent

    conversation_id: str | int | User | Conversation

    ID of conversation in which reaction will be sent (Required if message_id isn’t instance Message)

    Return
    Returns:

    bool

    await app.send_message_reaction("❤️", "123", "123-345")
    

Creating a Tweet

  • async TwitterAsync.create_tweet(text: str, files: list[str | UploadedMedia | tuple[str, str]] = None, filter_: str = None, reply_to: str = None, quote: str = None, place: str | Place = None, batch_compose: bool = False, community_id: int | str | Community = None, post_on_timeline: bool = False)

    Create a Tweet using the authenticated user

    Arguments
    text: str

    Content of the message to be sent

    files(optional): list[str | UploadedMedia | tuple[str, str]]

    List of Filepath of the files to be sent

    filter_(optional)
    :type: str |  TweetConversationFilters

    Filter to be applied for Tweet Audience. More about Search Filters

    reply_to(optional): str | Tweet

    ID of tweet to reply to

    quote: str | Tweet

    ID of tweet to Quote

    pool: dict

    Add a pool in tweet

    place: str | Place

    Add a place in tweet

    batch_compose: bool

    This tweet is part of a thread

    community_id: str | int | Community

    Tweet in a specific community

    post_on_timeline: bool

    Post it on your main timeline (only used if posting in a community)

    Return
    Returns:

    Tweet

    message = await app.create_tweet("user", reply_to="1690430294208483322")
    

Liking the Tweet

  • async TwitterAsync.like_tweet(tweet_id: str | int | Tweet)

    Post a Like on a Tweet

    Arguments
    tweet_id: str | int | Tweet

    Id of the Tweet

    Return
    Returns:

    bool

    await app.like_tweet("123456789")
    

Un-Liking the Tweet

  • async TwitterAsync.unlike_tweet(tweet_id: str | int | Tweet)

    UnLike a Posted a Like on a Tweet

    Arguments
    tweet_id: str | int | Tweet

    Id of the Tweet

    Return
    Returns:

    bool

    await app.unlike_tweet("123456789")
    

Retweeting the Tweet

  • async TwitterAsync.retweet_tweet(tweet_id: str | int | Tweet)

    Post a Retweet on a Tweet

    Arguments
    tweet_id: str | int | Tweet

    Id of the Tweet

    Return
    Returns:

    bool

    await app.retweet_tweet("123456789")
    

Delete a Retweet

  • async TwitterAsync.delete_retweet(tweet_id: str | int | Tweet)

    Delete a Retweet on a Tweet

    Arguments
    tweet_id: str | int | Tweet

    Id of the Tweet

    Return
    Returns:

    bool

    await app.delete_retweet("123456789")
    

Follow a User

  • async TwitterAsync.follow_user(user_id: str | int | User)

    Follow a User

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    User

    await app.follow_user("123456789")
    

UnFollow a User

  • async TwitterAsync.unfollow_user(user_id: str | int | User)

    Un-Follow a User

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    User

    await app.unfollow_user("123456789")
    

Block a User

  • async TwitterAsync.block_user(user_id: str | int | User)

    Block a User

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    User

    await app.block_user("123456789")
    

Un-Block a User

  • async TwitterAsync.unblock_user(user_id: str | int | User)

    Block a User

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    User

    await app.unblock_user("123456789")
    

Get Community

  • async TwitterAsync.get_community(community_id: str | int)

    Get a Community Details

    Arguments
    community_id: str | int

    Id of the Community

    Return
    Returns:

    Community

    from tweety import Twitter
    
    app = Twitter("session")
    await app.get_community("123456789")
    

Get Community Tweets

  • async TwitterAsync.get_community_tweets(community_id: str | int | Community, pages: int = 1, filter_: str = None, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_community_tweets(community_id: str | int | Community, pages: int = 1, filter_: str = None, wait_time: int = 2, cursor: str = None)

    Get the Tweets of the specified community (iter for generator)

    Arguments
    community_id(Required): int | str | Community

    ID of the community you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    filter_(optional): str = None

    Filter you would like to apply on the tweets. More about Search Filters

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    CommunityTweets

    Returns:

    Generator: (CommunityTweets, list[Tweet])

    from tweety import Twitter
    
    app = Twitter("session")
    tweets = await app.get_community_tweets(12345678)
    for tweet in tweets:
        print(tweet)
    

Get Community Members

  • async TwitterAsync.get_community_members(community_id: str | int | Community, pages: int = 1, filter_: str = None, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_community_members(community_id: str | int | Community, pages: int = 1, filter_: str = None, wait_time: int = 2, cursor: str = None)

    Get the Members of the specified community (iter for generator)

    Arguments
    community_id(Required): int | str | Community

    ID of the community you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    filter_(optional): str = None

    Filter you would like to apply on the tweets. More about Search Filters

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    CommunityMembers

    Returns:

    Generator: (CommunityMembers, list[User])

    from tweety import Twitter
    
    app = Twitter("session")
    users = await app.get_community_members(12345678)
    for user in users:
        print(user)
    

Delete Tweet

  • async TwitterAsync.delete_tweet(tweet_id: str | int | Tweet)

    Delete a Tweet posted by authenticated user

    Arguments
    tweet_id: str | int | Tweet

    Id of the Tweet

    Return
    Returns:

    Bool

    await app.delete_tweet("123456789")
    

Enable User Notifications

  • async TwitterAsync.enable_user_notification(user_id: str | int | User)

    Enable user notification on new tweet from specific user

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    Bool

    await app.enable_user_notification("123456789")
    

Disable User Notifications

  • async TwitterAsync.disable_user_notification(user_id: str | int | User)

    Disable user notification on new tweet from specific user

    Arguments
    user_id: str | int | User

    Id of the User

    Return
    Returns:

    Bool

    await app.disable_user_notification("123456789")
    

Get Notified Tweets

  • async TwitterAsync.get_tweet_notifications(pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_tweet_notifications(pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Tweets of the user whom the authenticated user has enabled the New Tweet Notification , (use iter for generator)

    Arguments
    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    TweetNotifications

    Returns:

    Generator: (TweetNotifications, list[Tweet])

    tweets = await app.get_tweet_notifications()
    for tweet in tweets:
        print(tweet)
    

Get User Followers

  • async TwitterAsync.get_user_followers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_user_followers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Followers of specified User , (use iter for generator)

    Arguments
    username: str | int | User

    Username of the target user

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserFollowers

    Returns:

    Generator: (UserFollowers, list[User])

    from tweety import Twitter
    
    app = Twitter("session")
    users = await app.get_user_followers()
    for user in users:
        print(user)
    

Get User Followings

  • async TwitterAsync.get_user_followings(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_user_followings(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Followings of specified User , (use iter for generator)

    Arguments
    username: str | int | User

    Username of the target user

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserFollowings

    Returns:

    Generator: (UserFollowings, list[User])

    from tweety import Twitter
    
    app = Twitter("session")
    users = await app.get_user_followings()
    for user in users:
        print(user)
    

Get User Subscribers

  • async TwitterAsync.get_user_subscribers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_user_subscribers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Subscribers of specified User , (use iter for generator)

    Arguments
    username: str | int | User

    Username of the target user

    pages(optional): int = 1

    Number of Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    UserSubscribers

    Returns:

    Generator: (UserSubscribers, list[User])

    from tweety import Twitter
    
    app = Twitter("session")
    users = await app.get_user_subscribers()
    for user in users:
        print(user)
    

Get Tweet Comments

  • async TwitterAsync.get_tweet_comments(tweet_id: int | str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None, get_hidden: bool = False)
  • async TwitterAsync.iter_tweet_comments(tweet_id: int | str | Tweet, pages: int = 1, wait_time: int = 2, cursor: str = None, get_hidden: bool = False)

    Get the Comments of specified Tweet , (use iter for generator)

    Arguments
    tweet_id: str | int | Tweet

    Target Tweet

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    get_hidden(optional): bool = False

    Get hidden comments or not

    Return
    Returns:

    TweetComments

    Returns:

    Generator: (TweetComments, list[ConversationThread])

    from tweety import Twitter
    
    app = Twitter("session")
    threads = await app.get_tweet_comments("123456789")
    for thread in threads:
        print(thread)
    

Get Lists

  • async TwitterAsync.get_lists(pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_lists(pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get lists of Authenticated User

    Arguments
    pages(optional): int = 1

    Number of Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    Lists

    Returns:

    Generator: (Lists, list[TwList])

    lists = await app.get_lists()
    for _list in lists:
        print(_list)
    

Create List

  • async TwitterAsync.create_list(name: str, description: str = '', is_private: bool = False)

    Create a List on Twitter

    Arguments
    name: str

    Name of List

    description: str = ""

    Description of List

    is_private: bool

    Either to create the list private or not

    Return
    Returns:

    TwList

    _list = await app.create_list("list_name")
    print(_list)
    

Delete List

  • async TwitterAsync.delete_list(list_id: str | int | TwList)

    Delete a List using List ID if authenticated user is Admin

    Arguments
    list_id: int | str | TwList

    ID of Target List

    Return
    Returns:

    bool

    _list = await app.delete_list("123515")
    print(_list)
    

Get List

  • async TwitterAsync.get_list(list_id: int)

    Get a List using List ID

    Arguments
    list_id: int | str

    ID of Target List

    Return
    Returns:

    TwList

    _list = await app.get_list("123515")
    print(_list)
    

Get List Tweets

  • async TwitterAsync.get_list_tweets(list_id: str | int | TwList, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_list_tweets(list_id: str | int | TwList, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get Tweets of specific List (iter for generator)

    Arguments
    list_id: int | str | TwList

    ID of Target List

    pages(optional): int = 1

    Number of Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    ListTweets

    Returns:

    Generator: (ListTweets, list[Tweet])

    tweets = await app.get_list_tweets("123515")
    for tweet in tweets:
        print(tweet)
    

Get List Members

  • async TwitterAsync.get_list_member(list_id: str | int | TwList, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_list_member(list_id: str | int | TwList, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get Tweets of specific List (iter for generator)

    Arguments
    list_id: int | str | TwList

    ID of Target List

    pages(optional): int = 1

    Number of Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    ListMembers

    Returns:

    Generator: (ListMembers, list[User])

    users = await app.get_list_member("123515")
    for user in users:
        print(user)
    

Add List Member

  • async TwitterAsync.add_list_member(list_id: str | int | TwList, user_id: str | int | User)

    Add a specific user from List

    Arguments
    list_id: int | str | TwList

    ID of Target List

    user_id: int | str | User

    ID of User to be added

    Return
    Returns:

    TwList

    _list = await app.add_list_member("123515", "elonmusk")
    print(_list)
    

Remove List Member

  • async TwitterAsync.remove_list_member(list_id: str | int | TwList, user_id: str | int | User)

    Remove a specific user from List

    Arguments
    list_id: int | str | TwList

    ID of Target List

    user_id: int | str | User

    ID of User to be added

    Return
    Returns:

    TwList

    _list = await app.remove_list_member("123515", "elonmusk")
    print(_list)
    

Get Topic

  • async TwitterAsync.get_topic(topic_id: str | int)

    Get a topic using ID

    Arguments
    topic_id: int | str

    ID of Topic

    Return
    Returns:

    Topic

    topic = await app.get_topic("123515")
    print(topic)
    

Get Topic Tweets

  • async TwitterAsync.get_topic_tweets(topic_id: str | int | Topic, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_topic_tweets(topic_id: str | int | Topic, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Tweets of the specified Topic (iter for generator)

    Arguments
    topic_id: str | int | Topic

    ID of the Topic

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    replies(optional): bool = False

    Fetch the Replied Tweets of the User

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    TopicTweets

    Returns:

    Generator : (TopicTweets , list[Tweet])

    tweets = await app.get_topic_tweets('123456')
    for tweet in tweets:
        print(tweet)
    

Get Tweet Analytics

  • async TwitterAsync.get_tweet_analytics(tweet_id: str | int | Tweet)

    Get Analytics of a Tweet (made by authenticated user)

    Arguments
    tweet_id: int | str | Tweet

    ID of Tweet

    Return
    Returns:

    TweetAnalytics

    tweet = await app.get_tweet_analytics("123515")
    print(tweet)
    

Get Mutual Friends/Followers

  • async TwitterAsync.get_mutual_followers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_mutual_followers(username: str | int | User, pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the Mutual Followers/Friends of a User (iter for generator)

    Arguments
    username: str | int | User

    Username of the user you want to get Tweets of.

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    MutualFollowers

    Returns:

    Generator : (MutualFollowers , list[User])

    users = await app.get_mutual_followers('elonmusk')
    for user in users:
        print(user)
    

Get Blocked Users

  • async TwitterAsync.get_blocked_users(pages: int = 1, wait_time: int = 2, cursor: str = None)
  • async TwitterAsync.iter_blocked_users(pages: int = 1, wait_time: int = 2, cursor: str = None)

    Get the users blocked by authenticated user (iter for generator)

    Arguments
    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    BlockedUsers

    Returns:

    Generator : (BlockedUsers , list[User])

    users = await app.get_blocked_users()
    for user in users:
        print(user)
    

Get Translated Tweet

  • async TwitterAsync.translate_tweet(tweet_id: str | int | Tweet, language: str)

    Get specific Tweet in a specific Language

    Arguments
    tweet_id: int | str | Tweet

    ID of Tweet

    language: str

    Language to which you want to translate

    Return
    Returns:

    TweetTranslate

    from tweety.filters import Language
    
    ...
    
    tweet = await app.translate_tweet("123515", Language.English)
    print(tweet)
    

Get Tweet History

  • async TwitterAsync.tweet_edit_history(identifier: str | int | Tweet)

    Get the Edit History of a Tweet

    Arguments
    identifier: int | str | Tweet

    ID of Tweet

    Return
    Returns:

    TweetHistory

    tweet = await app.tweet_edit_history("123515")
    print(tweet)
    

Search Gifs

  • async TwitterAsync.search_gifs(search_term: str, pages: int = 1, cursor: str = None, wait_time: int = 2)
  • async TwitterAsync.iter_search_gifs(search_term: str, pages: int = 1, cursor: str = None, wait_time: int = 2)

    Search Gifs Available on Twitter (iter for generator)

    Arguments
    search_term: str

    Search Term against which gifs to be searched

    pages(optional): int = 1

    Number of Tweet Pages you want to get

    wait_time(optional): int = 2

    Number of seconds to wait between multiple requests

    cursor(optional): str = None

    Pagination cursor if you want to get the pages from that cursor up-to (This cursor is different from actual API cursor)

    Return
    Returns:

    GifSearch

    Returns:

    Generator : (GifSearch , list[Gif])

    gifs = await app.search_gifs("Happy")
    for gif in gifs:
        print(gif)
    

Get Scheduled Tweets

  • async TwitterAsync.get_scheduled_tweets()

    Get the Scheduled Tweets of authenticated User

    Return
    Returns:

    ScheduledTweets

    tweets = await app.get_scheduled_tweets()
    print(tweets)
    

Delete Scheduled Tweets

  • async TwitterAsync.delete_scheduled_tweet(tweet_id: str | int | ScheduledTweet)

    Get the Scheduled Tweets of authenticated User

    Arguments
    tweet_id: str | int | ScheduledTweet

    ID of scheduled Tweet

    Return
    Returns:

    bool

    await app.delete_scheduled_tweet("12345")
    

Pin a Tweet

  • async TwitterAsync.pin_tweet(tweet_id: str | int | Tweet)

    Pin a Specific Tweet on your Timeline

    Arguments
    tweet_id: str | int | Tweet

    ID of Tweet

    Return
    Returns:

    bool

    await app.pin_tweet("12345")
    

Un-Pin a Tweet

  • async TwitterAsync.unpin_tweet(tweet_id: str | int | Tweet)

    Un-Pin a Specific Tweet on your Timeline

    Arguments
    tweet_id: str | int | Tweet

    ID of Tweet

    Return
    Returns:

    bool

    await app.unpin_tweet("12345")
    

New Grok Conversation

  • async TwitterAsync.create_grok_conversation()

    Create a New Grok Conversation

    Return
    Returns:

    str

    await app.create_grok_conversation()
    

Get Grok Conversation

  • async TwitterAsync.get_grok_conversation(conversation_id: str | int)

    Get a New Grok Conversation using its ID

    Arguments
    conversation_id: str | int

    ID of Conversation

    Return
    Returns:

    GrokConversation

    await app.get_grok_conversation("1232")
    

Get Grok Response

  • async TwitterAsync.get_grok_response(text: str, conversation_id: str | int | GrokConversation = None)

    Get Response against your prompt from GROK

    Arguments
    text: str

    Message / text to get response against

    conversation_id: str | int | GrokConversation

    Continuing previous conversation

    Return
    Returns:

    (GrokMessage, GrokConversation)

    await app.get_grok_response("Hi , draw a robot")
    

Get Suggested Users

  • async TwitterAsync.get_suggested_users()

    Get Users suggested to you by Twitter

    Return
    Returns:

    list[User]

    await app.get_suggested_users()