如何通过编程方式获取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. 成功后会给你一个发送一个邮件,并可以登录查看你的专用公钥私钥字符串。
awiskey.jpg


  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做了一个小的测试应用,程序界面如下:
awisProgram.jpg


8. 最后贴一些代码辅助大家
ContractedBlock.gif ExpandedBlockStart.gif          获取Response的信息 #region 获取Response的信息
InBlock.gif
InBlock.gif        
public UrlInfoResponseResponse GetUrlInfoResponse(string website, string action, string responseGroup)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            UrlInfoRequestSecurity usecurity = new UrlInfoRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            UrlInfoRequest request 
= new UrlInfoRequest();
InBlock.gif            request.Url 
= website;
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif
InBlock.gif            UrlInfo urlInfo 
= new UrlInfo();
InBlock.gif            urlInfo.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            UrlInfoResponse uresponse 
= alexa.UrlInfo(urlInfo);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public CategoryBrowseResponseResponse GetCategoryBrowseResponse(string website, string action, string responseGroup, string path, bool description)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            CategoryBrowseRequestSecurity usecurity = new CategoryBrowseRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            CategoryBrowseRequest request 
= new CategoryBrowseRequest();
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif            request.Path 
= path;
InBlock.gif            request.Descriptions 
= description.ToString();
InBlock.gif
InBlock.gif            CategoryBrowse browse 
= new CategoryBrowse();
InBlock.gif            browse.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            CategoryBrowseResponse uresponse 
= alexa.CategoryBrowse(browse);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public SitesLinkingInResponseResponse GetSitesLinkingInResponse(string website, string action, string responseGroup)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            SitesLinkingInRequestSecurity usecurity = new SitesLinkingInRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            SitesLinkingInRequest request 
= new SitesLinkingInRequest();
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif            request.Url 
= website;
InBlock.gif
InBlock.gif            SitesLinkingIn browse 
= new SitesLinkingIn();
InBlock.gif            browse.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            SitesLinkingInResponse uresponse 
= alexa.SitesLinkingIn(browse);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public TrafficHistoryResponseResponse GetTrafficHistoryResponse(string website, string action, string responseGroup)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            TrafficHistoryRequestSecurity usecurity = new TrafficHistoryRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            TrafficHistoryRequest request 
= new TrafficHistoryRequest();
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif            request.Url 
= website;
InBlock.gif
InBlock.gif            TrafficHistory browse 
= new TrafficHistory();
InBlock.gif            browse.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            TrafficHistoryResponse uresponse 
= alexa.TrafficHistory(browse);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public CategoryListingsResponseResponse GetCategoryListingsResponse(string website, string action, string responseGroup, string path, bool recursive)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            CategoryListingsRequestSecurity usecurity = new CategoryListingsRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            CategoryListingsRequest request 
= new CategoryListingsRequest();
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif            request.Path 
= path;//this.cmbListingPath.Text
InBlock.gif
            request.Recursive = recursive.ToString();//this.chkRecurse.Checked.ToString();
InBlock.gif

InBlock.gif            CategoryListings browse 
= new CategoryListings();
InBlock.gif            browse.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            CategoryListingsResponse uresponse 
= alexa.CategoryListings(browse);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public CrawlResponseResponse GetCrawlResponse(string website, string action, string responseGroup)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string timestamp = Helper.GetTimestamp();
InBlock.gif            
string signature = Helper.MakeSignature(action + timestamp, privateKey);
InBlock.gif
InBlock.gif            
//Set the request security settings
InBlock.gif
            CrawlRequestSecurity usecurity = new CrawlRequestSecurity();
InBlock.gif            usecurity.AWSAccessKeyId 
= publicKey;
InBlock.gif            usecurity.Signature 
= signature;
InBlock.gif            usecurity.Timestamp 
= timestamp;
InBlock.gif
InBlock.gif            CrawlRequest request 
= new CrawlRequest();
InBlock.gif            request.ResponseGroup 
= responseGroup;
InBlock.gif            request.Security 
= usecurity;
InBlock.gif            request.Url 
= website;
InBlock.gif
InBlock.gif            Crawl browse 
= new Crawl();
InBlock.gif            browse.Request 
= request;
InBlock.gif
InBlock.gif            AWSAlexa alexa 
= new AWSAlexa();
InBlock.gif            CrawlResponse uresponse 
= alexa.Crawl(browse);
InBlock.gif
InBlock.gif            
return uresponse.Response;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedBlockEnd.gif        
#endregion
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值