Package: tweetScraping
Tweet ScrapingPrerequisitesInternet ConnectionPython 3.6+Must have present credentials (i,e: consumer key, consumer secret, access token, access token secret) by creating an account on Twitter DevThe code will create the output in the form of a csv file at the location of same codeThe dataset created will be unique at tweetid levelInstalling Tweet Scrapingpip3installtweetScrapingUsing tweetScrapingJust import tweetScraping and call functions!Code Usage:importtweetScrapinga=tweetScraping.tweetScraping(consumer_key:str,consumer_secret:str,access_token:str,access_token_secret:str,query:str,[file_name:str],[no_of_tweets:int])a.start()Code Example:NOTE: These are dummy keys and tokens and are only for representation, please replace these with your credentialsimporttweetScrapinga=tweetScraping.tweetScraping('ghF98tufKbgWpGxHVbBTkx9L5','EiyUJ9aEdwTEKEe2HLuo8ZhBTJscztgaEpSBY38YZhSUkq1Az4','1099325182525661186-9dn78kOA4Z09plZWPHrn9nmgdukg6j','dZMfqR9O4eCQLvS0bnWNYr9eivjS4wtwsPY8WnBugR5xJ','GOT',1000)a.start()This will output a csv file by the name GOT.csv, with 1000 tweets, this 1000 tweets can be increased furtherDescription of 33 columns created in the form of structured data from twitter unstructured data1)tweet_id:thetweetidprefizedandsuffixedby'~'sothatnodigitsarelost2)tweet_created_at:WhenwasthetweetpostedonTwitter3)tweet_created_on_holiday_bool:Abooleantotellifthetweetwaspostedonanationalholidayornot(True:Yes,False:No)4)tweet_created_on_weekend_bool:Abooleantotellifthetweetwaspostedonaweekendornot(True:Yes,False:No)5)tweet_created_at_noon_bool:Abooleantotellifthetweetwaspostedduringnoonhoursornot(True:Yes,False:No)5)tweet_created_at_eve_bool:Abooleantotellifthetweetwaspostedduringeveninghoursornot(True:Yes,False:No)6)user_id:Twitteruseraccountfromwhichthetweetwaspostedprefixedandsuffixedby'~'sothatnointegerislost7)user_screen_name:Twitteruserscreennamefromwhichthetweetwasposted,willhaveactualcase(Ifitiscamelcaseitremainsasis)8)user_screen_name_length:LengthoftheTwitteruserscreennamefromwhichthecurrenttweetwasposted9)user_no_of_tweets:Howmanytweetshavebeenpostedfromthescreennamesincedateofcreationofaccounttillthedatethiscodegettingexecuted10)user_no_of_followers:NumberoffollowersoftheTwitteruserscreennamefromwhichthecurrenttweetwasposted11)user_no_of_followings:NumberofaccountstheTwitteruserscreennamefollowfromwhichthecurrenttweetwasposted12)user_account_age:HowoldtheTwitteruseraccountonTwitterisfromwhichthecurrenttweetwasposted(currentdate-accountcreationdate)13)user_no_of_favourites:NumberoftweetslikedbytheTwitteruserscreennamefromwhichthecurrenttweetwasposted14)user_average_tweets:Onadailybasis,howmanytweetstheTwitteruserscreennamepostfromwhichthecurrenttweetwasposted15)user_average_favourites:Onadailybasis,howmanytweetstheTwitteruserscreennamelikefromwhichthecurrenttweetwasposted16)user_account_location:Thegeographicallocation(ifshared)theTwitteruserscreennamefromwhichthecurrenttweetwasposted17)tweet_text:Tweettextpostcleaning(cleaningdonefor(@[A-Za-z0-9]+)|([^0-9A-Za-z\t])|(\w+:\/\/\S+),andcasestandardization)18)tweet_text_length:Lengthofthetweettextpostcleaning19)tweet_text_optimal_length:Abooleantotellifthetweetpostedwasofoptimallengthorlesspriortocleaning(True:Yes,False:No)20)tweet_text_no_of_hashtags:Howmanyhashtagswerepresentintheoriginaltweettextbeforecleaningthetext21)tweet_text_contains_hashtags:Abooleantotellifthetweetpostedhadahashtagornotpriortocleaning(True:Yes,False:No)22)tweet_text_contains_url:Abooleantotellifthetweetpostedhadanyurlembeddedpriortocleaning(True:Yes,False:No)23)tweet_text_no_of_user_mentions:Howmanyotherscreennamesweretaggedinthetweettextusing'@'24)tweet_text_contains_user_mentions:Abooleantotellifthetweetpostedhad
anyusermentionspriortocleaning(True:Yes,False:No)25)tweet_text_sentiment:Thesentimentofthetweet26)tweet_text_contains_media:Abooleantotellifthetweetpostedhadanymultimediapriortocleaning(True:Yes,False:No)27)tweet_text_contains_number:Abooleantotellifthetweetpostedhadanynumberspriortocleaning(True:Yes,False:No)28)tweet_text_contains_upper_words:Abooleantotellifthetweetpostedhaduppercasewordstoemphasizethemeaningpriortocleaning(True:Yes,False:No)29)tweet_text_contains_lower_words:Abooleantotellifthetweetpostedhadlowercasewordspriortocleaning(True:Yes,False:No)30)tweet_text_contains_excl:Abooleantotellifthetweetpostedhadexclamationspriortocleaning(True:Yes,False:No)31)tweet_text_contains_retweet_suggestion:Abooleantotellifthetweetpostedhad'RT'askingtoretweetpriortocleaning(True:Yes,False:No)32)retweeted:Abooleantotellifthetweetpostedreceivedanyr
etweetsornot(True:Yes,False:No)33)retweets:Howmanyactualnumberofretweetsthecurrentretweetreceivedattimewhenyouarerunningthiscode