Finding inlink information from Yahoo! in Python

linkbuildinglu7Inlinks (aka backlinks) are an important aspect of your SEO strategy. They are the ways that people will find your website and they are an indicator to search engines that your website is important and should rank well. So it is important to keep an eye on this statistic for your website. There is a saying: “you can’t manage what you can’t measure” which applies. If you want your website to rank well you need to manage your inlinks and so you need to measure them.

This script requires a Yahoo! AppID because it uses the REST API for Yahoo! Site Explorer rather than any scraping of pages which you can get by going to the Yahoo! Developer Network.

The script simply returns the total number of results but you could easily extend this to print out all your inlinks. I will be using this to track my inlink count over time by running it every day and storing the result in a database.

Example Usage:

$ python yahooInlinks.py http://www.halotis.com
checking http://www.halotis.com
937

Here’s the Python Code:

#!/usr/bin/env python 
# -*- coding: utf-8 -*-
# (C) 2009 HalOtis Marketing
# written by Matt Warren
# http://halotis.com/
 
import urllib2, sys, urllib
 
try:
   import json
except:
   import simplejson as json # http://undefined.org/python/#simplejson
 
YAHOO_APP_ID='YOUR API KEY'
 
def yahoo_inlinks_count(query):
    if not query.startswith('http://') raise Exception('site must start with "http://"')
 
    request = 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=' + YAHOO_APP_ID + '&query=' + urllib.quote_plus(query) + '&output=json&results=0'
 
    try:
    	results = json.load(urllib2.urlopen(request))
    except:
    	raise Exception("Web services request failed")
    	sys.exit()
 
    return results['ResultSet']['totalResultsAvailable']
 
if __name__=='__main__':
    print 'checking', sys.argv[1]
    print yahoo_inlinks_count(sys.argv[1])
Bookmark and Share

Technorati Tags: , , , , , ,

Related posts:

  1. Scrape Yahoo Search Results Page
  2. Scrape Google Search Results Page
  3. Google Translate API Python Script
  4. Getting CPA statistics from Neverblue
  5. RSS Twitter Bot in Python
Stumble it!


RSS feed | Trackback URI

10 Comments »

2009-08-16 06:30:10

[...] View original here:  Finding inlink information from Yahoo! in Python [...]

 
2009-08-16 09:17:27

[...] Finding inlink report from Yahoo! in Python | HalOtis Marketing [...]

 
Comment by mariocesar_bo
2009-08-16 22:33:26

#share Finding inlink information from Yahoo! in Python http://ow.ly/15LgOP

This comment was originally posted on Twitter

 
Comment by JumboResults4u
2009-08-17 01:29:23

Finding inlink information from Yahoo! in Python | HalOtis Marketing: Entrepreneurship on the web. starting a ne.. http://tinyurl.com/nf3avh

This comment was originally posted on Twitter

 
Comment by halotis
2009-08-19 19:53:18

Finding inlink information from Yahoo! in Python – Inlinks (aka backlinks) are an important aspect of your SEO stra.. http://bit.ly/16yuJF

This comment was originally posted on Twitter

 
Comment by gregorysaxton
2009-08-20 12:51:01

Finding inlink information from Yahoo! in Python – Inlinks (aka backlinks) are an important aspect of your SEO stra.. http://bit.ly/4RIpT

This comment was originally posted on Twitter

 
Comment by halotis
2009-08-29 10:01:09

Finding inlink information from Yahoo! in Python – Inlinks (aka backlinks) are an important aspect of your SEO stra.. http://bit.ly/3t73dK

This comment was originally posted on Twitter

 
Comment by Dip
2010-02-17 15:41:18

How mutch request make do? Before ban.

 
Comment by dsf
2010-05-29 14:19:19

thanks for these freat tips.
an easier method to gather yahoo data (and other) is by using http://ministatus.com. one could also download the gathered results in pdf form for later usage.

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped=""> in your comment.

Additional comments powered by BackType