Long ago, around 4 years ago already, I implemented a Twitter Fingerprinting tool in PHP that was available for everybody which unfortunately stopped working when the API changed. I was really excited because I could also help the Spanish police with another version of this online tool.

Recently, I decided to implement something similar in Python, but with a considerable difference: not using the Twitter API. There are many reasons:

  • Due to the own Twitter API limitation, you cannot use the application intensively. I do not know the limit nowadays, but long ago it was around 150 requests per hour and IP.
  • I do not usually like that the guys of Twitter know what I am doing with the API.
  • If you use the API, you have to make an account, and use certain credentials. Some people may not like this.
  • Less flexibility. With the API you only can do what you can only do. Obviously.

On the other hand, the basic disadvantage of not using the API and parsing code with regexps directly is that a small change in their website will make the code not work properly.

After saying this, here is the Github link of this small library where you can find more information.

An example of how to use it:

Get all the images uploaded from a specific user:

from TwitterFingerprint import TwitterFingerprint
tw = TwitterFingerprint("google")
tw.obtainLastTweets() # Get all tweets

Get the language, hashtags, and text (tweet) of the last 30 tweets:

from TwitterFingerprint import TwitterFingerprint
tw = TwitterFingerprint("google")
for tweet in tw.tweets:

Get three histograms (months, weekdays, hours) of the last 500 tweets. Interesting when analyzing when someone is using Twitter.

from TwitterFingerprint import TwitterFingerprint
tw = TwitterFingerprint("google")
[histMonths,histWeekdays,histHours] = tw.getHistograms()