如何通过编程方式获取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. 最后贴一些代码辅助大家
ExpandedBlockStart.gif          #region 获取Response的信息
InBlock.gif
InBlock.gif        
public UrlInfoResponseResponse GetUrlInfoResponse(string website, string action, string responseGroup)
ExpandedSubBlockStart.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.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.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.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.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.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
本文转自博客园伍华聪的博客,原文链接: 如何通过编程方式获取alexa排名的数据,如需转载请自行联系原博主。


目录
相关文章
|
2月前
|
人工智能 API UED
汇总:5个国产版chatgpt中文网站,可用来写代码文章小说
目前已经有一些替代方案,使得中国用户也能够在国内网络条件下使用ChatGPT。这些站点通过调用ChatGPT的API接口,实现了对语言模型的调用,为用户提供了类似于原版ChatGPT的功能和体验。
|
10月前
|
数据采集 安全 搜索推荐
怎么使用谷歌趋势去了解关键词?
答案是:可通过semrush或Google Search Console工具获取关键词来发外链。 Google Trends是一个强大的工具,可以帮助你了解全球的搜索趋势。 你可以利用这个工具了解特定的搜索关键词、主题、地理位置等方面的数据,了解他们随着时间的变化而变化的趋势。 以下是如何使用Google Trends来了解关键词的方法。
89 0
怎么使用谷歌趋势去了解关键词?
|
9月前
|
数据采集 搜索推荐 安全
谷歌独立站关键词少?
答案是:关键词少可以选择竞争难度低且有一定流量的关键词。 关键词研究的重要性 深入了解目标受众 为了有效地吸引和保持用户的关注,你需要确保你的内容与他们的需求和兴趣相匹配。 通过对目标受众的深入研究,你可以更好地了解他们在谷歌上搜索的关键词。
91 0
谷歌独立站关键词少?
|
10月前
|
数据采集 搜索推荐 安全
韩文谷歌排名怎么做?
答案是:选择竞争难度低且有一定流量的关键词。 理解韩文Google优化的价值 为什么要进行韩文Google优化 Google是全球范围内最受欢迎的搜索引擎之一,对于韩文网站来说,进行有效的Google优化可以在搜索结果中获得更高的排名,吸引更多的用户。 选择和优化韩文关键词 如何找出并优化合适的韩文关键词 关键词的选择与优化在韩文Google优化中扮演着关键角色。 找到并妥善使用适当的韩文关键词,可以帮助提升网站在Google搜索结果中的排名。
51 0
韩文谷歌排名怎么做?
|
算法 SEO
谷歌优化排名怎么做出来的?谷歌排名多久做上去?
如果你只是为了抄袭,搬运同行文章,说实话你没有谷歌排名和流量是对的,因为你不配拥有。
116 0
谷歌优化排名怎么做出来的?谷歌排名多久做上去?
|
搜索推荐
孚盟:怎么利用LinkedIn快速搜索国外客户资源?
对于做外贸来说,LinkedIn是一个非常优秀的B2B营销平台,尤其是在B2B行业可以为您带来更多的潜在客户、助力企业面向全球打造商业品牌、拓展人脉资源、积累客户资源,并帮助企业发展业务。
124 0
孚盟:怎么利用LinkedIn快速搜索国外客户资源?
小马识途:影响抖音搜索排名的因素有哪些?
近年来,互联网进入下半场,移动端的新媒体抢到了流量风口,尤其是以抖音小红书为首的短视频平台深受关注。小马识途的客户开始通过抖音做推广、做宣传的企业越来越多,其中有一些公司已经尝到了抖音seo带来的甜头,加入抖音seo优化的企业日渐增多。 抖音seo优化没有一个标准的市场价,一般来说抖音seo优化方式可以分为两类:1.找代运营公司;2.使用抖音seo优化系统。
215 0
|
搜索推荐 JavaScript 前端开发
如何在移动搜索中获得更好的排名
1、机器可读 蜘蛛当前只能读懂文本内容,flash、Javascript、图片等非文本内容蜘蛛暂时不支持读取。 尽量不要在重要的位置使用搜索引擎不能读取的元素,例如:标题、导航、内容等等。
215 0