twitter4j

How to create a Twitter client in Scala

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 15.10, “How to create a Twitter client in Scala.”

Problem

You want to create a client to connect to Twitter to access the information you want, such as showing timelines and trends.

A Scala Twitter client example

Just a quick note here today that if you want to create a Twitter client in Scala, the Java Twitter4J library looks like a good path to take.

I've shown an example below, where you can see that besides the eight lines of code it takes to create a Scala twitter object, the actual code you need to get information from the Twitter developer API is pretty short.