如何通過編程方式獲取alexa排名的數(shù)據(jù) |
發(fā)布時間: 2012/8/27 9:41:36 |
Alexa 是以發(fā)布世界網(wǎng)站排名而引人注目的一個網(wǎng)站。其實,此網(wǎng)站的搜索引擎也很好用,但是“網(wǎng)站排名”卻是它吸引眼球的最主要原因。
以網(wǎng)站導航起家的Alexa創(chuàng)建于1996年4月,他們的目的是讓Internet沖浪者在分享虛擬世界資源的同時,更多地參與Internet資源的組織。2002年5月Alexa放棄了自己的搜索引擎與Google合作。他們每天在網(wǎng)上搜集超過1,000GB的信息,然后進行整合發(fā)布。現(xiàn)在他們搜集的URL數(shù)量已經(jīng)超過了Google。下圖是他們自己給出的一個信息量比較圖?v軸為已有的URL地址的量,以十億為單位。也就是說在量上,Alexa位居世界四大名搜索引擎第一位,已經(jīng)超過了350億。焦點在于,Alexa不僅給出這350多億網(wǎng)址的鏈接,而且為其中的每一個網(wǎng)站進行了排名?梢哉f,Alexa是當前擁有URL數(shù)量最龐大,排名信息發(fā)布最詳盡的網(wǎng)站。 Alexa的世界網(wǎng)站排名主要分兩種:綜合排名,可以叫做絕對排名,即特定的一個網(wǎng)站在所有350多億網(wǎng)站中的名次。Alexa每三個月公布一次新的網(wǎng)站綜合排名。此排名的依據(jù)是用戶鏈接數(shù)(Users Reach)和頁面瀏覽數(shù)(Page Views)三個月累積的幾何平均值。分類排名一是按主題分類,比如新聞、娛樂、購物等,Alexa給出某個特定網(wǎng)站在同一類網(wǎng)站中的名次。Alexa將其收集到的網(wǎng)站共分了16個大類,每個類下又分為多個主題。 阿里媽媽的網(wǎng)站也有Alexa網(wǎng)站排名(http://tool.alimama.com/site.php)、中國站長網(wǎng)站(http://alexa.chinaz.com/Index.asp)也提供Alexa排名查詢,還有很多網(wǎng)站也提供了它們的Alexa排名,這些排名的數(shù)據(jù)都是通過調用稱為Alexa Web Information Service (AWIS)的服務,地址是http://awis.amazonaws.com/doc/2005-07-11/AWSAlexa.wsdl。 那么我們如何才能使用這些服務,以便創(chuàng)建我們的Alexa排名查詢操作呢? 1. 首先你通過網(wǎng)站連接http://www.amazon.com/gp/browse.html?node=12782661,了解它是做什么的,收費如何(1000次約人民幣1元左右)。 2. 注冊一個帳號,綁定您的銀行卡或者信用卡 3. 成功后會給你一個發(fā)送一個郵件,并可以登錄查看你的專用公鑰私鑰字符串。 4. 根據(jù)這些你就可以訪問它的AWIS訪問了,如果你要了解進一步的開發(fā)的話,請參考這里的文檔: 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等,這些包含了各類排名等數(shù)據(jù)。 7. 我調用了AWIS做了一個小的測試應用,程序界面如下: 8. 最后貼一些代碼輔助大家 獲取Response的信息#region 獲取Response的信息 public UrlInfoResponseResponse GetUrlInfoResponse(string website, string action, string responseGroup) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings UrlInfoRequestSecurity usecurity = new UrlInfoRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; UrlInfoRequest request = new UrlInfoRequest(); request.Url = website; request.ResponseGroup = responseGroup; request.Security = usecurity; UrlInfo urlInfo = new UrlInfo(); urlInfo.Request = request; AWSAlexa alexa = new AWSAlexa(); UrlInfoResponse uresponse = alexa.UrlInfo(urlInfo); return uresponse.Response; } public CategoryBrowseResponseResponse GetCategoryBrowseResponse(string website, string action, string responseGroup, string path, bool description) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings CategoryBrowseRequestSecurity usecurity = new CategoryBrowseRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; CategoryBrowseRequest request = new CategoryBrowseRequest(); request.ResponseGroup = responseGroup; request.Security = usecurity; request.Path = path; request.Descriptions = description.ToString(); CategoryBrowse browse = new CategoryBrowse(); browse.Request = request; AWSAlexa alexa = new AWSAlexa(); CategoryBrowseResponse uresponse = alexa.CategoryBrowse(browse); return uresponse.Response; } public SitesLinkingInResponseResponse GetSitesLinkingInResponse(string website, string action, string responseGroup) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings SitesLinkingInRequestSecurity usecurity = new SitesLinkingInRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; SitesLinkingInRequest request = new SitesLinkingInRequest(); request.ResponseGroup = responseGroup; request.Security = usecurity; request.Url = website; SitesLinkingIn browse = new SitesLinkingIn(); browse.Request = request; AWSAlexa alexa = new AWSAlexa(); SitesLinkingInResponse uresponse = alexa.SitesLinkingIn(browse); return uresponse.Response; } public TrafficHistoryResponseResponse GetTrafficHistoryResponse(string website, string action, string responseGroup) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings TrafficHistoryRequestSecurity usecurity = new TrafficHistoryRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; TrafficHistoryRequest request = new TrafficHistoryRequest(); request.ResponseGroup = responseGroup; request.Security = usecurity; request.Url = website; TrafficHistory browse = new TrafficHistory(); browse.Request = request; AWSAlexa alexa = new AWSAlexa(); TrafficHistoryResponse uresponse = alexa.TrafficHistory(browse); return uresponse.Response; } public CategoryListingsResponseResponse GetCategoryListingsResponse(string website, string action, string responseGroup, string path, bool recursive) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings CategoryListingsRequestSecurity usecurity = new CategoryListingsRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; CategoryListingsRequest request = new CategoryListingsRequest(); request.ResponseGroup = responseGroup; request.Security = usecurity; request.Path = path;//this.cmbListingPath.Text request.Recursive = recursive.ToString();//this.chkRecurse.Checked.ToString(); CategoryListings browse = new CategoryListings(); browse.Request = request; AWSAlexa alexa = new AWSAlexa(); CategoryListingsResponse uresponse = alexa.CategoryListings(browse); return uresponse.Response; } public CrawlResponseResponse GetCrawlResponse(string website, string action, string responseGroup) { string timestamp = Helper.GetTimestamp(); string signature = Helper.MakeSignature(action + timestamp, privateKey); //Set the request security settings CrawlRequestSecurity usecurity = new CrawlRequestSecurity(); usecurity.AWSAccessKeyId = publicKey; usecurity.Signature = signature; usecurity.Timestamp = timestamp; CrawlRequest request = new CrawlRequest(); request.ResponseGroup = responseGroup; request.Security = usecurity; request.Url = website; Crawl browse = new Crawl(); browse.Request = request; AWSAlexa alexa = new AWSAlexa(); CrawlResponse uresponse = alexa.Crawl(browse); return uresponse.Response; } #endregion 本文出自:億恩科技【mszdt.com】 |