如何通过编程方式获取alexa排名的数据

Alexa 是以发布世界网站排名而引人注目的一个网站。其实,此网站的搜索引擎也很好用,但是“网站排名”却是它吸引眼球的最主要原因。 
    以网站导航起家的Alexa创建于1996年4月,他们的目的是让Internet冲浪者在分享虚拟世界资源的同时,更多地参与Internet资源的组织。2002年5月Alexa放弃了自己的搜索引擎与Google合作。他们每天在网上搜集超过1,000GB的信息,然后进行整合发布。现在他们搜集的URL数量已经超过了Google。下图是他们自己给出的一个信息量比较图。纵轴为已有的URL地址的量,以十亿为单位。也就是说在量上,Alexa位居世界四大名搜索引擎第一位,已经超过了350亿。焦点在于,Alexa不仅给出这350多亿网址的链接,而且为其中的每一个网站进行了排名。可以说,Alexa是当前拥有URL数量最庞大,排名信息发布最详尽的网站。   
  Alexa的世界网站排名主要分两种:综合排名,可以叫做绝对排名,即特定的一个网站在所有350多亿网站中的名次。Alexa每三个月公布一次新的网站综合排名。此排名的依据是用户链接数(Users Reach)和页面浏览数(Page Views)三个月累积的几何平均值。分类排名一是按主题分类,比如新闻、娱乐、购物等,Alexa给出某个特定网站在同一类网站中的名次。Alexa将其收集到的网站共分了16个大类,每个类下又分为多个主题。 

      阿里妈妈的网站也有Alexa网站排名(http://tool.alimama.com/site.php)、中国站长网站(http://alexa.chinaz.com/Index.asp)也提供Alexa排名查询,还有很多网站也提供了它们的Alexa排名,这些排名的数据都是通过调用称为Alexa Web Information Service (AWIS)的服务,地址是http://awis.amazonaws.com/doc/2005-07-11/AWSAlexa.wsdl
    那么我们如何才能使用这些服务,以便创建我们的Alexa排名查询操作呢?
  1. 首先你通过网站连接http://www.amazon.com/gp/browse.html?node=12782661,了解它是做什么的,收费如何(1000次约人民币1元左右)。
  2. 注册一个帐号,绑定您的银行卡或者信用卡
  3. 成功后会给你一个发送一个邮件,并可以登录查看你的专用公钥私钥字符串。
如何通过编程方式获取alexa排名的数据

4. 根据这些你就可以访问它的AWIS访问了,如果你要了解进一步的开发的话,请参考这里的文档:
http://docs.amazonwebservices.com/AlexaWebInfoService/2005-07-11/
5. 如果你有疑问,可以在论坛中询问,当然都是老外的了。http://developer.amazonwebservices.com/connect/forum.jspa?forumID=14
6.   AWIS有很多Response,如UrlInfoResponseResponse、CategoryBrowseResponseResponse、SitesLinkingInResponseResponse、TrafficHistoryResponseResponse、CategoryListingsResponseResponse、CrawlResponseResponse等,这些包含了各类排名等数据。
7. 我调用了AWIS做了一个小的测试应用,程序界面如下:
如何通过编程方式获取alexa排名的数据
8. 最后贴一些代码辅助大家
如何通过编程方式获取alexa排名的数据        #region 获取Response的信息
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public UrlInfoResponseResponse GetUrlInfoResponse(string website, string action, string responseGroup)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            UrlInfoRequestSecurity usecurity = new UrlInfoRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            UrlInfoRequest request 
= new UrlInfoRequest();
如何通过编程方式获取alexa排名的数据            request.Url 
= website;
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            UrlInfo urlInfo 
= new UrlInfo();
如何通过编程方式获取alexa排名的数据            urlInfo.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            UrlInfoResponse uresponse 
= alexa.UrlInfo(urlInfo);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public CategoryBrowseResponseResponse GetCategoryBrowseResponse(string website, string action, string responseGroup, string path, bool description)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            CategoryBrowseRequestSecurity usecurity = new CategoryBrowseRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            CategoryBrowseRequest request 
= new CategoryBrowseRequest();
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据            request.Path 
= path;
如何通过编程方式获取alexa排名的数据            request.Descriptions 
= description.ToString();
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            CategoryBrowse browse 
= new CategoryBrowse();
如何通过编程方式获取alexa排名的数据            browse.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            CategoryBrowseResponse uresponse 
= alexa.CategoryBrowse(browse);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public SitesLinkingInResponseResponse GetSitesLinkingInResponse(string website, string action, string responseGroup)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            SitesLinkingInRequestSecurity usecurity = new SitesLinkingInRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            SitesLinkingInRequest request 
= new SitesLinkingInRequest();
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据            request.Url 
= website;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            SitesLinkingIn browse 
= new SitesLinkingIn();
如何通过编程方式获取alexa排名的数据            browse.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            SitesLinkingInResponse uresponse 
= alexa.SitesLinkingIn(browse);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public TrafficHistoryResponseResponse GetTrafficHistoryResponse(string website, string action, string responseGroup)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            TrafficHistoryRequestSecurity usecurity = new TrafficHistoryRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            TrafficHistoryRequest request 
= new TrafficHistoryRequest();
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据            request.Url 
= website;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            TrafficHistory browse 
= new TrafficHistory();
如何通过编程方式获取alexa排名的数据            browse.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            TrafficHistoryResponse uresponse 
= alexa.TrafficHistory(browse);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public CategoryListingsResponseResponse GetCategoryListingsResponse(string website, string action, string responseGroup, string path, bool recursive)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            CategoryListingsRequestSecurity usecurity = new CategoryListingsRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            CategoryListingsRequest request 
= new CategoryListingsRequest();
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据            request.Path 
= path;//this.cmbListingPath.Text
如何通过编程方式获取alexa排名的数据
            request.Recursive = recursive.ToString();//this.chkRecurse.Checked.ToString();
如何通过编程方式获取alexa排名的数据

如何通过编程方式获取alexa排名的数据            CategoryListings browse 
= new CategoryListings();
如何通过编程方式获取alexa排名的数据            browse.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            CategoryListingsResponse uresponse 
= alexa.CategoryListings(browse);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
public CrawlResponseResponse GetCrawlResponse(string website, string action, string responseGroup)
如何通过编程方式获取alexa排名的数据        
{
如何通过编程方式获取alexa排名的数据            
string timestamp = Helper.GetTimestamp();
如何通过编程方式获取alexa排名的数据            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
//Set the request security settings
如何通过编程方式获取alexa排名的数据
            CrawlRequestSecurity usecurity = new CrawlRequestSecurity();
如何通过编程方式获取alexa排名的数据            usecurity.AWSAccessKeyId 
= publicKey;
如何通过编程方式获取alexa排名的数据            usecurity.Signature 
= signature;
如何通过编程方式获取alexa排名的数据            usecurity.Timestamp 
= timestamp;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            CrawlRequest request 
= new CrawlRequest();
如何通过编程方式获取alexa排名的数据            request.ResponseGroup 
= responseGroup;
如何通过编程方式获取alexa排名的数据            request.Security 
= usecurity;
如何通过编程方式获取alexa排名的数据            request.Url 
= website;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            Crawl browse 
= new Crawl();
如何通过编程方式获取alexa排名的数据            browse.Request 
= request;
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            AWSAlexa alexa 
= new AWSAlexa();
如何通过编程方式获取alexa排名的数据            CrawlResponse uresponse 
= alexa.Crawl(browse);
如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据            
return uresponse.Response;
如何通过编程方式获取alexa排名的数据        }

如何通过编程方式获取alexa排名的数据
如何通过编程方式获取alexa排名的数据        
#endregion
本文转自博客园伍华聪的博客,原文链接:如何通过编程方式获取alexa排名的数据,如需转载请自行联系原博主。