Rapid Protoyping with the SEOmoz API

I am out in Seattle for the SEOmoz PRO seminar (don’t forget to come to the London seminar!) where the second day has kicked off with two of the best presentations I’ve seen in a long time from Seth Besmertnik from Conductor and Wil Reynolds from Seer Interactive. Feeling the pressure a little bit for my session on Sexy Reporting this afternoon, I thought I’d share one extra tip.

I often need to build a quick n’ dirty bit of analysis of link data. Since the exports from Open Site Explorer only pull 10,000 links at a time, I look to pull data out of the SEOmoz API and dump it into Excel.

This little bash script (which needs the domain and credentials inputting) lets you quickly pull backlink data:

( for i in {1..250}; do curl “http://lsapi1.seomoz.com/linkscape/links/XXXXXXXXXXX?Filter=external&SourceCols=133982846973&TargetCols=133982846973&Sort=page_authority&AccessID=XXXXXXXXXXX&Expires=XXXXXXXXXXX&Signature=XXXXXXXXXXX&Scope=page_to_domain&Limit=5&Offset=$((i100))&”; done ) | tr “}” “n” | perl -pe “s/[][]//g” | perl -pe “s/,{//g” | perl -pe “s/”[^“]”://g“ | perl -pe ”s/^{//g“ >> output.csv

I’ll be talking a little bit about doing stuff with this in my presentation later today, including decoding bitflags in Excel.

If you like the presentations from the Distilled crew, you might like to sign up to our free conference calls.

Will Critchlow

Will Critchlow

Will founded Distilled with Duncan in 2005. Since then, he has consulted with some of the world’s largest organisations and most famous websites, spoken at most major industry events and regularly appeared in local and national press. Will is part...   read more

Get blog posts via email


  1. Adam

    Okay, I may be a little dull here, but I can't seem to get this to work. I'm not replacing something properly it seems.

    I assume I'm replacing the first X's with the domain I'm checking, the second with my username, not sure on the third and the fourth with my password. What am I missing?

    reply >
  2. @Adam - sorry - I should have been clearer there. You need to generate access credentials which you can do on this page:

    reply >
  3. Hi Will,

    I assume you ran this batch script on Linux or you can do it on Windows? Just a thought. Great stuff.

    reply >
  4. Red

    Can you not do it on GNU for windows with the right dependencies?? GNUWin32?

    reply >
  5. Will Critchlow

    Hi guys - I've only tried this on Linux, but I don't see any reason why it wouldn't work on windows if you have the right shell...

    reply >

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>