The following Python code snippet returns with the number of referring sites of the given URL. Class
YahooBacklink uses direct GET query to count the backlinks. Instead of just parsing the total from the first page, using a bit trick we query the real, unique backlink count. In the source code backlink and pattern are two attributes holding the realization dependent data, so you can extend
YahooBacklink to get a Google backlink check tool, just hide these two class variables so it would fit to Google’s service scheme.
YahooAPIBackLink based on the Yahoo developer API, so you must have your own Yahoo developer’s application ID (so do the SDK) in order to use it. This solution gives much more result counts, hence it’s up to you which one you want to use. Please note the first method has the limitation that the largest backlink count might be 1000 which would be not ideal for huge sites.