binn1e / tweet-blender

A Python script that reports basics and funny stats about your Twitter usage over a specifiable period and allows you to sort and export your tweets using advanced content and date filtering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#tweet-blender

A Python quick commande line tool including two features :

  1. Quirky Twitter usage stats reporting over a specifiable period
  2. Tweets sorting and exporting using advanced content and date filtering

##usage

As soon as you get it from twitter.com, just unzip your archive on your hard drive and place common_words.txt_ file, common_domains.txt file, and tweet_blender.py in the same folder.

stats feature

$ python tweet_blender.py
Runs the script to reports and print stats stdout.

$ python tweet_blender.py -start 24062012
Add date filtering to get data covering a specific period of your life.

$ python tweet_blender.py -end 31122009
$ python tweet_blender.py -start 01062009 -end 31122009

The stats feature displays a bucnh of funny stats and a few of your « top things » — example below for example lists your most common tweeted words:

× stop repeating yourself :
— 1.  fucking
— 2.  fuck
— 3.  code
— 4.  super
— 5.  cool

Data used in above example is courtesy of my husband, and yes, in case you're wondering : I am very proud!

Here's a bunch of other things you can get:

× software spots:
— 1.  Tweetbot for iOS
— 2.  HootSuite
— 3.  Echofon
— 4.  Twitter for iPhone
— 5.  Instagram
× devoted entertainers:
— 1.  @c0unt0
— 2.  @singletau
— 3.  @korben
— 4.  @smwhr
— 5.  @@lesarchivistes
× this is, literally, your twitter face:
— 1.  :)
— 2.  :/
— 3.  :D
— 4.  :x
— 5.  ;)
× top domains:
— 1.  wikipedia.org
— 2.  wired.com
— 3.  reddit.com
— 4.  vice.com
— 5.  slashdot.org

These are just a few, there are many more!

If you want to resize tops to get more data, please use -t option like this :

$ python tweet_blender.py -t 42 - whenever possible, this displays your 42 most tweeted smileys, internet domains, etc...

### sort and export feature

All commands listed below desactivate stats feature, then turn script into an exporter which stores selected tweets to the sorted.csv file.

$ python tweet_blender.py -start ddmmyyyy
Includes tweets from given date (included.)

$ python tweet_blender.py -end ddmmyyyy
Includes tweets until given date (included.)

$ python tweet_blender.py -aany pattern [pattern ...]
Includes tweets containing pattern or pattern n. Patterns maybe a word, "an expression" or "a regexp?".

$ python tweet_blender.py -aall pattern [pattern ...]
Includes tweets containing pattern and pattern n.

$ python tweet_blender.py -rany pattern [pattern ...]
Removes tweets containing pattern or pattern n.

$ python tweet_blender.py -rall pattern [pattern ...]
Removes tweets containing pattern and pattern n.

Both [-aany] or [-aall] inclusion options can be combined with [-rany] or [-rall] exclusion options. Date filtering can be combined with any options. For example :

$ python tweet_blender.py -aany pizza "video games" -rall programming coffee
Adds to selection tweets that contain 'pizza' or 'video games' and removes from selection tweets that contain both 'programming' and 'coffee'.

$ python tweet_blender.py -aall @binnie 'cof+e+' -rany pizza donut cookie
Adds to selection tweets that contain '@binnie' and match 'cof+e+' and removes from selection tweets that contain 'pizza' or 'donut' or 'cookie'.

To make your query case insensitive, add [-i] option

$ python tweet_blender.py -start 20122012 -end 27122012 -aany "hip hop" party -rany "oh oh oh" -i

This outputs all your xmas 2012 tweets speaking about hip hop or parties, removing santa jokes.

## help


python tweet_blender.py -h
usage: tweet_blender [-h] [-aany pattern [pattern ...] | -aall pattern
                     [pattern ...]] [-rany pattern [pattern ...] | -rall
                     pattern [pattern ...]] [-start pattern [pattern ...]]
                     [-end pattern [pattern ...]] [-i] [-t size]

Process some tweets.

optional arguments:
  -h, --help            show this help message and exit
  -aany pattern [pattern ...]
                        Include tweets containing any of the listed
                        expressions.
  -aall pattern [pattern ...]
                        Include tweets containing all of the listed
                        expressions.
  -rany pattern [pattern ...]
                        Remove tweets containing any of the listed
                        expressions.
  -rall pattern [pattern ...]
                        Remove tweets containing all of the listed
                        expressions.
  -start pattern [pattern ...]
                        Include tweets from given date. [Format : ddmmyyyy]
  -end pattern [pattern ...]
                        Include tweets until given date. [Format : ddmmyyyy]
  -i                    Make command case insensitive.
  -t size               Define tops size.

notes

  • Please feel free to edit the common_words.txt file or common_domains.txt file as you wish in order to obtain more accurate personal and funny results.
  • common_words.txt contains around 1000 french words so you may want to delete them if you tweet only in english, so the script can run quicker.

Dependencies : none.

About

A Python script that reports basics and funny stats about your Twitter usage over a specifiable period and allows you to sort and export your tweets using advanced content and date filtering


Languages

Language:Python 100.0%