Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter: How to extract tweets containing symbols (!,%,$)?

For a project, I want to be able to create a dataset of tweets containing some particular string of symbols. Since I would also like to go as far back in time as possible, I tried using the GetOldTweets script ( https://github.com/Jefferson-Henrique/GetOldTweets-python ) mentioned here: https://stackoverflow.com/a/35077920/5858873 .

The issue is, it isn't able to extract tweets containing symbols as input. In fact, one cannot even search directly on Twitter for any tweets consisting of required symbols.

To more clearly explain the problem, consider the following sample case. I would l like to extract all tweets containing the string '!!!' within the last two years.

What is the best way to do this (if this even is doable)?

like image 437
Melsauce Avatar asked Nov 22 '17 00:11

Melsauce


People also ask

How do I extract tweets from Twitter?

Navigate to your app dashboard. Select the app you've enabled with the Tweets and users preview, then click Details. Select the Keys and tokens tab. In the Consumer API Keys section, copy the values for API Key into consumer_key and API Secret Key into consumer_secret .

Which Twitter object contains the list of hashtags used in a Tweet?

Hashtag object The entities section will contain a hashtags array containing an object for every hashtag included in the Tweet body, and include an empty array if no hashtags are present. The PowerTrack # Operator is used to match on the text attribute.


1 Answers

You can create your own regular expression on the basis of your requirement and
then hit the twitter data to extract the specific tweets.

like image 57
krits Avatar answered Sep 30 '22 20:09

krits