Tagtwitter

Free Twitter Data Set

I needed a twitter data set for my thesis and struggled to find one that was freely available. I ended up downloading the data I needed so I thought I would release it here.  It does come in a slightly annoying format which is a MongoDB dump file but it should be easy enough to extract to there and use it. The structure of each record is shown below.

So if you wanted to go over all records in the database you would do it like this –

Download Twitter Mongo Dump

Too Busy To Tweet

For my thesis I am investigating methods for finding the happiness on Twitter. I’ll release a lot more of the information and data after it is all completed. But for now here are some small and interesting finds.

Number of tweets separated by day of the week.

What the above image shows is my full data set of tweets (around 400,000) and on which day those tweets were sent. Interesting to note is that weekends have around half as many posts as the weekdays. I know I definitely use Twitter more when I’m procrastinating.

As well as having the least amount of traffic, the weekends also suffer from an increased number of negative tweets. The graph below shows my take on finding the happiest day of the week.

Happiness across days of the week ( repeated for ease of viewing)

There have been several studies aiming to find the happiest days of the week; from psychological studies into the idea that Monday is the unhappiest day of the week to studies also using Twitter as their statistical source.

What this appears to show is that the weekend suffers from a large scale drop in happiness from a week day high on Thursday. There does seem to be some correlation between the number of tweets sent on a day and the over all happiness of that day. Is it possible that when we are happy we want to share that with the world?

More information and graphs will follow as the study continues.

WordPress Twitter Integration

Moved host from the fairly useless 123-reg and am now with http://krystal.co.uk/ (their servers are located in an ex MOD bunker!), so I thought it was high time to give the website the usual refresh and do up. This time I am using WordPress and so far so good really. Excellent support and community, simply fantastic administration section. Couldn’t ask for more.

I’m in the process of adding features and fixing things around the site. Also I am moving content over from the old site to here as it can’t be easily imported. The old site is still available using an alternate link, http://www.low-tech.co.uk/, which will be moved over at a later date.

So one thing I thought I’d share is how I integrated my Twitter feed into my main feed on the site as I saw a few people asking about it and there isn’t a plugin available for it. It’s very simple really but requires editing of PHP files, I might make it into a plugin when I have a bit of spare time to learn how plugins work.

Firstly you need to set up some cron job or alternative for downloading your Twitter RSS feed however frequently you like. Your Twitter RSS feed is located at:

https://twitter.com/statuses/user_timeline/{your_twitter_username}.rss

Once you have got that inside a folder it’s time to parse it. Instead of using some sort of XML parser I am instead using a nice XML2Array function that I found here http://www.bin-co.com/php/scripts/xml2array/.

Create a function in your functions.php file to parse your RSS feed, mine looks like this.

Now in your home.php or index.php you need to use that function to get your array of tweets and then put them into your main feed. The idea is that in your main while loop you first check your tweet array to see if you have tweets that are newer than that post, if there are then display the tweet and remove it from the array. Eventually all the tweets left are older than the posts on that page so you can just output them at the end.

My home.php has this inside the main loop with $tweets being the array of tweets.

At the end simply repeat the foreach loop to print the remaining tweets in the tweet array.

© 2019 Acodemics

Theme by Anders NorénUp ↑