从黑莓应用程序世界(API)获取应用程序特定数据的最佳方式

2024-04-24 20:23:11 发布

您现在位置:Python中文网/ 问答频道 /正文

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

到目前为止,我已经得到了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解决方案使用苹果提供的API,Android解决方案模拟手机并收集数据,就像真实手机以结构化的方式进行收集一样。在

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


Tags: 数据comapi应用程序网站方式解决方案itunes
3条回答

我在.NET中使用Selenium WebDriverphantomDriverCSQuery来抓取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();
 }

在开始编码之前,请在您的电脑中下载Selenium WebDriver和phantom驱动程序(如C:\Users\rakesh\Documents\Selenium\PhantomJSDriver),并在visualstudio中安装CSQuery。在

安装Web驱动程序:

^{pr2}$

安装phantomjs:

^{3}$

我已经抓取黑莓网站有一段时间了,到目前为止还没有更新的问题。在

您是否使用来自文档根目录的绝对xpath来提取数据?您可以使用相对XPath来制作更健壮的刮板:

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

我在.net中使用selenium webdriver和phantomDriver以及csquery来抓取黑莓网站,到目前为止还没有更新的问题。在

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

相关问题 更多 >