Morphex's blogologue (Life, technology, music, politics, business, mental health and more)

This is the blog of Morten W. Petersen, aka. morphex in various places. I blog about my life, and what I find interesting and/or important. This is a personal blog without any editor or a lot of oversight so treat it as such. :)

My email is morphex@gmail.com.

I am leavingnorway.info.

An OGG/Vorbis player, implemented in Javascript.

My Kiva bragging page
My shared (open source) code on GitHub

Morphex's Blogodex

News
Me on Instagram
Slashdot

Zope hosting by Nidelven IT

Morten Petersen on Linkedin

Morten Petersen on Facebook

Morten Petersen on SoundCloud

Morten Petersen on MixCloud

Blogologue on Twitter



Older entries



Atom - Subscribe - Categories

Facebook icon Share on Facebook Google+ icon Share on Google+ Twitter icon Share on Twitter LinkedIn icon Share on LinkedIn

Resolving URLs from a URL shortening service in Java

So, in my efforts to create a tool to keep a (complete) archive of my Twitter activity, I today wrote a tool to help replace t.co URLs in my tweets, with the actual URL, here:

https://github.com/morphex/twitter-exporter/commit/3341f7780...

Now I come from the Python world, and lately I've been looking at Java to learn it properly. To improve my chances of having gigs that are interesting, regardless of programming language.

I started looking at URL objects and generating a connection from that, but since I'm going to resolve a lot of t.co addresses, found that it would be better if I kept an HTTPS connection open to the t.co server, and then pass the final part of the URL over to t.co. Another issue here is maybe a "resting period" between each resolved URL, so as to not appear "spammy" or "resource hogging" on the t.co server.

Anyway, luckily I found an example online that I could adapt for my purposes, and I'd have to say, compared to Python, Java is a bit bureacratic with its classes and types, but other than that, Java is just fine.


[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [01 Apr 12:05 Europe/Oslo]