Hacking Ask.fm for fun and profit (fun mostly, no profit yet): introducing AskFM::Client
I used to be bored by friends on Facebook always sharing their Ask.fm replies and bothering other people to read them and/or to go and ask them questions.
I had an idea. Since Ask.fm is so cool and so popular, it would have been nice to make an “official” Ask.fm account, let other people go there and ask question, wait for answers, NOT getting them, and freak out. Lol.
The thing is, I got bored pretty soon of the Ask.fm website. It forced me to keep a Firefox tab (and thus Firefox) open while I spend most of my time in the shell.
I gave a quick look at its webpage’s source code and I thought that maybe it was hackable — and yes, it was.
My hack then is to write a Perl library to interface Perl programs with the Ask.fm world, and to give myself a pure-text ask.fm client to use within the shell, programmatically.
So, where do I begin? The simplest form of this sort of challenge is called “webpage scraping”. It consists in writing a program that requests webpages on your behalf as if it wac actually you using a browser, fill form as if it was you filling them, digging the HTML of the response (using various techniques) and giving you back the data.
The language of choice was, of course, Perl, since it’s WWW::Mechanize it’s well know for working so well. And yes, it does.
In the next days, maybe, I’ll write something about how Ask.fm works.
I’ve seen it’s written using Ruby on Rails.
I’m not sure about this, but it seems to me it exposes some of its internal data-structures to the world. Maybe further
hacking research will show something interesting.
By the way, my works are on my github page, located at:
A little note: the module is not yet “definitive”, there’s still something I have to fix.
Various TODO lines in the source code will let you know things I have to fix/change.
Will it work forever?
Short answer: NO.
Long answer NO, because it’s heavily based on the website source code. Sadly, Ask.fm people don’t provide users with an API.. So.. I had to find a workaround.
Using the code is pretty straightforward, some examples are in the SYNOPSIS section of AskFM::Client module, but I’ll write more documentation and more example scripts in the next days.
At the moment, I’ve successfully written a script which posts answers to people’s walls and another script that answers to questions reversing questions’ text.
I’ll write some sort of bot/daemon. Easiest way would be letting that script be run every X minutes by cron. I’ll see what fits better.
Will I upload it to CPAN? I would like to. It’s pretty experimental now, not redy to go to CPAN. I’ve requested a PAUSE account (http://pause.perl.org), in case.
Well, it’s all for now,