How I “hacked” up a Nairaland API and got banned

 

Disclaimer: I was bored, alone at home and this nairaland.com post inspired the hack.

After reading the nairaland post, I actually started thinking if it was possible to actually design an API that programmers could use to extend the capabilities of nairaland.com like logging in, creating new topics, consuming nairaland data and other common functions programmatically. I fired up my text editor and started trying to reverse engineer the basic nairaland functions I wanted.  The awesome PYTHON Requests library came in very useful and after some few minutes my API could login, logout, create a new topic on any board, edit user profile (i.e. change email and password).

I guess my posts to nairaland during my build process of the API was suspicious due to the fast rate it was coming in and the random boards I was posting to as I was promptly banned from the site.

REASONS WHY NAIRALAND IS ANTI-API

1. PAGEVIEWS, PAGEVIEWS and PAGEVIEWS: Since nairaland started selling self serve adverts, one of the selling points it uses to woo advertisers is the number of pageviews/visitors or eyeballs it has. I think the reason why the nairaland overlords are anti-API is because they feel once users start consuming nairaland without actually visiting the site, pageviews would drop and also advertising revenue (Which is a rather myopic view).

2. SPAM: Nairaland.com currently has 1,005,971 users. Although this is a debatable figure as it is known that most users have more than 1 user account on the site. Most do it to advertise goods and services, create topics etc. Some people with ulterior motives once they get a live working API might start to automate posting, trolling and most likely drown the site in spammy topics etc.

3. Nairaland is resistant to change: It took nairaland almost 7 years of existence to move from simple machine forums to a home grown solution done in Python (cherrypy and MySQL) to be exact. The UI of the site might hurt sensitive eyes and this wont change any time soon.  If the most basic basic things wont change for the better, why would the nairaland overlords embrace an API?

The above reasons are just speculations on my part.

Update: I have since been unbanned by nairaland, but since I am no longer bored and idle, the API might not be receiving any developer love from me any time soon as I am working on more interesting stuff. In case you are interested, you can check it out here: https://github.com/aitoehigie/unofficial-nairalandAPI (pls note: use at your own risk of being banned too).

Latest Update: I posted a link to this post on the programming board of nairaland to see if I could get some takers on the API but before I could blink an eyelid, I was immediately banned again from the site and the link was instantly deleted by the mods,which goes to prove my above theories to be 100% correct.

Pystar

Advertisements

22 thoughts on “How I “hacked” up a Nairaland API and got banned

  1. i’d like to play with the api. Nl is quite primitive not only aesthetically but functionally. Can u please send the code to me!?

  2. Hey Pystar,

    Is it possible to integrate this API into the code for a website in order to enable login capabilities using nairaland login details?

  3. Sup Py,
    The URL seem to have changed or is there some vudoo am not seeing ?

    def post_topic(self, title, body, board):
    self.user.post(“http://www.nairaland.com/do_newtopic”,
    data=dict(title=title, body=body, board=board,
    session=self.user.cookies[“session”]))

    1. The key to reverse engineering nairaland functions is basically viewing the FORMS HTML source. It’s pretty straight forward, if a page has a form, view source. Thats all.

    1. this script is written in Python. If you can import python scripts into your android dev environment then I dont see why you cant use it

  4. […] discussions around APIs in Nigeria have been dramatic on one end and lulling on another. In 2013, a contributor on the popular Nigerian online forum, Nairaland, Aito Ehigie, figured he could build a… only to find his account blocked on the network for his […]

  5. How do I ban a mod in NL, this mod feels they have full autonomy to tamper with ones account,, I want to ban one of the NL mod so that he too can feel the pain of banning people for no good reason.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s