Tweet

def comment_a_tweet(selenium_session,url,text=""):
  • Explanation

    • This function will comment a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to comment
    • text -text to comment
  • Return:

    • True if the comment succed
    • False if it failed
def comment_a_tweet_with_media(selenium_session,url,text="",filepath="",type="picture"):
  • Explanation

    • This function will comment a tweet with a media
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to comment
    • text -text to comment
    • filepath -filepath of the media to add to the comment
    • type -type of the filepath to add to the comment (picture or video)
  • Return:

    • True if the comment with media succed
    • False if it failed
def comment_a_tweet_with_poll(selenium_session,url,text="",nb_of_choice=2,choice1_text="1",choice2_text="2",choice3_text="3",choice4_text="4",days=1,hours=0,minutes=0):
  • Explanation

    • This function will comment a tweet with a poll
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to comment
    • text -text to comment
    • nb_of_choice -number of choice for the poll from 2 to 4
    • choice1_text -the text of the choice 1 on the poll
    • choice2_text -the text of the choice 2 on the poll
    • choice3_text -the text of the choice 3 on the poll (If you set nb_of_choice to 2 or lower you can set choice3_text to "")
    • choice4_text -the text of the choice 4 on the poll (If you set nb_of_choice to 3 or lower you can set choice4_text to "")
    • days: -the number of days the poll should last
    • hours: -the number of hours the poll should last
    • minutes: -the number of minutes the poll should last
  • Return:

    • True if the comment with poll succed
    • False if it failed
def is_tweet_a_comment(selenium_session,url):
  • Explanation

    • This function will check if a tweet is a comment
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to check
  • Return:

    • True if the tweet is a comment
    • False if the tweet is not a comment
def is_tweet_exist(selenium_session,url):
  • Explanation

    • This function will check if a tweet exist
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to check
  • Return:

    • True if the tweet is exist
    • False if the tweet doesn't exist
def get_tweet_info(selenium_session,url):
  • Explanation

    • This function will get info of a tweet (username,text,id,date,number of likes, number of retweets,number of quotes,number of bookmarks,number of views)
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to check
  • Return:

    • A dict containing (username,text,id,date,number of likes, number of retweets,number of quotes,number of bookmarks,number of views)
    • False if the tweet doesn't exist
def like_a_tweet(selenium_session,url):
  • Explanation
    • This function will like a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to like
  • Return:

    • True if the like succed or the tweet was already liked
    • False if the like failed
def unlike_a_tweet(selenium_session,url):
  • Explanation
    • This function will unlike a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to unlike
  • Return:

    • True if the unlike succed or the tweet was already unliked
    • False if the unlike failed
def check_if_tweet_liked(selenium_session,url):
  • Explanation
    • This function check if a tweet is liked
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to check
  • Return:

    • True if the tweet is liked
    • False if the tweet wasn't liked or the function failed
def get_list_of_user_who_like_a_tweet(selenium_session,url,nb_of_like):
  • Explanation

    • This function will retrieve a list of users who liked a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retrieve list of users
    • nb_of_like -number of users to see (the limit is at 2000 to avoid long running code)
  • Return:

    • If it succed a list of users who liked the tweet
    • If it failed an empty list
def get_list_of_user_who_retweet_a_tweet(selenium_session,url,nb_of_rt):
  • Explanation

    • This function will retrieve a list of users who retweet a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retrieve list of users
    • nb_of_rt -numbers of users to see (the limit is at 2000 to avoid long running code)
  • Return:

    • If it succed a list of users who retweet the tweet
    • If it failed an empty list
def get_list_of_quote_of_a_tweet(selenium_session,url,nb_of_quote):
  • Explanation

    • This function will retrieve a list of user who quoted a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retrieve list of quotes
    • nb_of_quote -number of quote to see (the limit is at 100 since twitter web show approximately 100 quoted tweets)
  • Return:

    • If it succed a list of dictionaries for each quoted tweet retrieved each one have the username ,text,id,url,date,number of likes ,number of retweets,the number of replies
    • If it failed an empty list
def get_list_of_comment_of_a_tweet(selenium_session,url,nb_of_comment):
  • Explanation

    • This function will retrieve comments of a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retrieve comment
    • nb_of_quote -number of comments to see (the limit is at 50 to avoid getting tweet that are not comment to the tweet)
  • Return:

    • If it succed a list of dictionaries for each comment retrieved each one have the username ,text,id,url,date,number of likes ,number of retweets,the number of replies
    • If it failed an empty list
def get_tweet_above(selenium_session,url):
  • Explanation

    • This function will retrieve info about the tweet above a comment/tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retrieve info about the comment/tweet above
  • Return:

    • If it succed a dictionarie for that have the username ,text,id,url,date of the tweet/comment
    • If it failed an empty dictionarie
def retweet_a_tweet(selenium_session,url):
  • Explanation

    • This function will retweet a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to retweet
  • Return:

    • True if the retweet succed or the tweet was already retweeted
    • False if it failed
def unretweet_a_tweet(selenium_session,url):
  • Explanation

    • This function will unretweet a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to unretweet
  • Return:

    • True if the unretweet succed or the tweet was already unretweeted
    • False if it failed
def check_if_tweet_retweet(selenium_session,url):
  • Explanation

    • This function will check if a tweet is retweeted
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to check
  • Return:

    • True if the tweet is retweeted
    • False if it failed or the tweet is not retweeted
def quote_a_tweet(selenium_session,url,text=""):
  • Explanation

    • This function will quote a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to quote
    • text -text to quote
  • Return:

    • True if the quote succed
    • False if it failed
def quote_a_tweet_with_media(selenium_session,url,text="",filepath="",type="picture"):
  • Explanation

    • This function will quote a tweet with a media
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to quote
    • text -text to quote
    • filepath -filepath of the media to add to the quote
    • type -type of the filepath to add to the quote (picture or video)
  • Return:

    • True if the quote with media succed
    • False if it failed
def search_tweet(selenium_session,query="hello",mode="recent",nb_of_tweet_to_search=10):
  • Explanation

    • This function will search tweet
  • Parameters:

    • selenium_session -selenium browser
    • query -query to search
    • mode -recent mode to search recent tweet and top to search top tweet
    • nb_of_tweet_to_search -Number of tweet so search
  • Return:

  • If it succed a list of dictionaries for each comment retrieved each one have the username ,text,id,url,date,number of likes ,number of retweets,the number of replies
  • An empty list if it failed
def get_trend(selenium_session):
  • Explanation

    • This function will get the top trend of the moment
  • Parameters:

    • selenium_session -selenium browser
  • Return:

    • A list of trend it it succed
    • An empty list if it failed
def make_a_tweet(selenium_session,url,text=""):
  • Explanation

    • This function will make a tweet
  • Parameters:

    • selenium_session -selenium browser
    • text -text of the tweet
  • Return:

    • True if the tweet succed
    • False if it failed
def make_a_tweet_with_media(selenium_session,text="",filepath="",type="picture"):
  • Explanation

    • This function will make a tweet with a media
  • Parameters:

    • selenium_session -selenium browser
    • text -text to tweet
    • filepath -filepath of the media to add to the tweet
    • type -type of the filepath to add to the tweet (picture or video)
  • Return:

    • True if the tweet with media succed
    • False if it failed
def make_a_tweet_with_poll(selenium_session,text="",nb_of_choice=2,choice1_text="1",choice2_text="2",choice3_text="3",choice4_text="4",days=1,hours=0,minutes=0):
  • Explanation

    • This function will make a tweet with a poll
  • Parameters:

    • selenium_session -selenium browser
    • text -text to tweet
    • nb_of_choice -number of choice for the poll from 2 to 4
    • choice1_text -the text of the choice 1 on the poll
    • choice2_text -the text of the choice 2 on the poll
    • choice3_text -the text of the choice 3 on the poll (If you set nb_of_choice to 2 or lower you can set choice3_text to "")
    • choice4_text -the text of the choice 4 on the poll (If you set nb_of_choice to 3 or lower you can set choice4_text to "")
    • days: -the number of days the poll should last
    • hours: -the number of hours the poll should last
    • minutes: -the number of minutes the poll should last
  • Return:

    • True if the tweet with poll succed
    • False if it failed
def delete_a_tweet(selenium_session,url,text=""):
  • Explanation

    • This function will make a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to delete
  • Return:

    • True if the was delete well
    • False if it failed or it wasn't your tweet
def bookmark_a_tweet(selenium_session,url):
  • Explanation

    • This function will bookmark a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to bookmark
  • Return:

    • True if the tweet was bookmark well or it was already bookmarked
    • False if it failed
def unbookmark_a_tweet(selenium_session,url):
  • Explanation

    • This function will unbookmark a tweet
  • Parameters:

    • selenium_session -selenium browser
    • url -url of the tweet to unbookmark
  • Return:

    • True if the tweet was unbookmark well or it was already unbookmarked
    • False if it failed