2011-07-13 33 views
4

我使用Python收集有关移动应用程序的统计数据,现在我正在寻找访问黑莓应用程序世界数据的最佳解决方案。从黑莓应用程序世界(API)获取应用程序特定数据的最佳方式

到目前为止,我已经获得了iOS(http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html)和Android(https://github.com/liato/android-market-api-py)的解决方案。 iOS解决方案使用Apple提供的API,Android解决方案模拟手机并收集数据的方式与真实手机以结构化方式执行此操作的方式相同。

现在我似乎无法找到类似的BlackBerry App World解决方案,所以我的问题是,最好的方法是什么?我可以刮这个网站,但我宁愿不要,因为如果他们改变他们的网站,我的刮板将会破坏。理想情况下,我会使用提供的API或模拟BlackBerry以更具结构化的方式访问App World数据。有什么建议么?

回答

1

我一直在刮黑莓网站一段时间,并没有到目前为止更新的问题。

您是否使用文档根目录中的绝对XPath来提取数据?您可以通过使用相对的XPath做出一个更强大的刮刀:

//div[@id="priceArea"]/div[@class="contentLic"] 
0

我一直在使用硒的webdriver和phantomDriver和csquery .NET中的一段时间,至今没有与更新问题拼抢黑莓手机网站。

//Creating dynamic browser and download the page source code based on apipath by using selenium web driver  
driver = new PhantomJSDriver(phantomDriverPath); 
//driver=new ChromeDriver(chromeDriverPath); 
driver.Url = "https://appworld.blackberry.com/webstore/search/"+<search app name>+"/?lang=en&countrycode=IN"; 
driver.Navigate(); 
//Waiting for page loading 
Thread.Sleep(2000);//2 seconds 
if (driver.PageSource != null) 
{ 
    //Assigning downloaded page source code to CSQuery 
    CQ dom = CQ.CreateDocument(driver.PageSource); 
    //Waiting for page loading 
    driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30)); 
    //find the elements what ever you want based on the id,class name,tag name 
    string title1 =  dom["#topListtopResultsAppTemplateHTML_listItem_0_title"].Text(); 
} 
0

我一直在用硒的webdriverphantomDriverCSQuery在.NET一会儿刮黑莓的网站,我至今仍未曾与更新的问题。

//Creating dynamic browser and download the page source code 
//based on apipath by using selenium web driver 
public IWebDriver driver; 
driver = new PhantomJSDriver(phantomDriverPath); 

//driver=new ChromeDriver(chromeDriverPath); 

driver.Url = "https://appworld.blackberry.com/webstore/search/"+appname+"/lang=en&countrycode=IN"; 
driver.Navigate(); 

//Waiting for page loading Thread.Sleep(2000);//2 seconds 
if (driver.PageSource != null){ 

//Assigning downloaded page source code to CSQuery 
CQ dom = CQ.CreateDocument(driver.PageSource); 

//Waiting for page loading 
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30)); 

//find the elements what ever you want based on the id,class name,tag name 
string title1 = dom["#topListtopResultsAppTemplateHTML_listItem_0_title"].Text(); 
} 

开始之前编码,请下载硒的webdriver和幻象驱动程序在你的电脑(如C:\Users\rakesh\Documents\Selenium\PhantomJSDriver),并在您的Visual Studio安装CSQuery。

安装的webdriver:

Install-Package Selenium.WebDriver 

安装phantomjs:

​​
相关问题