What is the fastest way to scrape HTML webpage in Android?

前端 未结 6 1650
滥情空心
滥情空心 2020-11-28 01:50

I need to extract information from an unstructured web page in Android. The information I want is embedded in a table that doesn\'t have an id.

6条回答
  •  日久生厌
    2020-11-28 02:31

    One way of doing this is to put the html into a String and then manually search and parse through the String. If you know that the tags will come in a specific order then you should be able to crawl through it and find the data. This however is kinda sloppy, so its a question of do you want it to work now? or work well?

    int position = (String)html.indexOf("
"); //html being the String holding the html code String field = html.substring(html.indexOf("",html.indexOf("",position)));

like i said... really sloppy. But if you're only doing this once and you need it to work, this just might do the trick.

提交回复
热议问题
",html.indexOf("",position)) + 4, html.indexOf("