从Blackberry App World(API)获取应用程序特定数据的最佳方式

时间:2011-07-13 09:30:14

标签: python api blackberry screen-scraping

我正在使用Python收集有关移动应用程序的统计信息,现在我正在寻找访问Blackberry App World数据的最佳解决方案。

到目前为止,我已经获得了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数据。有什么建议吗?

3 个答案:

答案 0 :(得分:1)

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

您是否正在使用文档根目录中的绝对XPath来提取数据?您可以使用相对XPath来创建更强大的scraper:

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

答案 1 :(得分:0)

我一直在使用selenium webdriver和phantomDriver以及.squery在.net中抓取Blackberry网站一段时间,并且到目前为止没有更新问题。

//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();
}

答案 2 :(得分:0)

我一直在使用 Selenium WebDriver phantomDriver 以及 CSQuery in .NET 抓取Blackberry网站一段时间,我还没有到目前为止更新的问题。

//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();
 }

在开始编码之前,请在PC中下载Selenium WebDriver和幻像驱动程序(如C:\Users\rakesh\Documents\Selenium\PhantomJSDriver)并在Visual Studio中安装CSQuery。

安装webdriver:

Install-Package Selenium.WebDriver

安装phantomjs:

Install-Package phantomjs.exe
相关问题