How do I perform Web Scraping in Android? [closed]

馋奶兔 提交于 2019-11-28 06:27:11

问题


I want to scrape my website and then use the data from the website to populate elements in my app, my website has login pages and certain pages only open after the login has been done.

I started working with HtmlUnit as it is a headless browser and completed the custom api in a java IDE, later i tried to use the jar i generated from the java IDE and found that there are incompatibility issues with HtmlUnit and Android.

Can anyone propose a solution to this problem?

Edit : Since no one actually answered this question I am currently going with a work around using android's native WebView, settings its Visibility to invisible and then using javascript interfacing to a Java object, I can inject JS code to scrape any data.


回答1:


Use Jsoup library for such purpose. Very handy and easy to use. Start with this answer and follow documents and other examples.




回答2:


  • Either you contribute to HtmlUnit to produce a version of HtmlUnit not using the missing dependencies from Android.
  • Or you can use an alternative method like this one, as this seems to be the path someone else go before you.

If a real headless browser able to manage any recent web features, would exist, it would mean a team would have developed it and then invest much effort in it (in supporting existing and coming features) consistently.

Apart from Opera, Chrome, IE, and Firefox browsers, there is no such team. I would point out Chromium (CEF) as the most open and actively supported cross language wise. Try Cef for java



来源:https://stackoverflow.com/questions/34469737/how-do-i-perform-web-scraping-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!