The following html doc has 1629 pages, and I want to get data from all of them:
Document doc = Jsoup.connect("https://nomenclator.anm.ro/medicamente?page=1").get();
I want to pass a parameter to "page" (see the url) as to include it in a loop.
How can I achive thease in Jsoup?
CodePudding user response:
There's no special way to handle URL parameters and the URL is passed as a string. You can simply modify that string in a loop to use loop index as page number:
for (int pageNumber = 1; pageNumber <= 1629; pageNumber ) {
Document doc = Jsoup.connect("https://nomenclator.anm.ro/medicamente?page=" pageNumber).get();
// handle current page here
}