JSoup will not receive all items?

So, I'm trying to parse a simple list using JSoup. Unfortunately, the program only returns records up to records starting with N in the list. I do not know why this is so. Here is my code:

public ArrayList<String> initializeMangaNameList(){ Document doc; try { doc = Jsoup.connect("http://www.mangahere.com/mangalist/").get(); Elements items = doc.getElementsByClass("manga_info"); ArrayList<String> names = new ArrayList<String>(); for(Element item: items){ names.add(item.text()); } return names; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } 

So why does the list not contain all entries? Is there a web page error? Or maybe a parser? Can I use a workaround to work around this problem? And what causes the problem in the first place?

+7
java list html parsing jsoup
source share
1 answer

It's good that the release was caused by a change in the JSoup version of version 1.72 and higher. You just need to change the default settings as follows:

 public ArrayList<String> initializeMangaNameList(){ Document doc; try { doc = Jsoup.connect("http://www.mangahere.com/mangalist/").maxBodySize(0).get(); Elements items = doc.getElementsByClass("manga_info"); ArrayList<String> names = new ArrayList<String>(); for(Element item: items){ names.add(item.text()); } return names; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; 

}

An important difference is setting maxBodySize to 0 so that it allows files of unlimited size to be used. More information can be found in the documentation . This will allow you to have unlimited body size and download all the necessary data.

+18
source share

All Articles