View on GitHub

twitanalysis

Dig your Twitter data

A very good title indeed.

Published: 2020-08-16 00:00:00 +0000


Getting the server set up

Nothing major, just using Scotty:

Perhaps the slightly more major thing, and indeed was the first thing I tried, before I even tried Scotty, was a library of Twitter types. I found this library, twitter-types (on Hackage), which seems a bit old, but nonetheless seem to work.

I also have some basic tests set up, and indeed, de-serialisation works.

Gotcha

The Twitter reference docs are showing a syntactically-invalid code-block as their example value for their JSON objects. In this case, it was the example for the Status object (i.e. a tweet) on the reference page for GET statuses/user_timeline:

image

image

Look at how the value part of the JSON expression didn’t escape the double-quotes. It caused me a lot of digging around before I found out what was wrong! I thought it was the twitter-types library that was out-of-date. Apparently no evidence for that yet!