A
A
Andres Iniesta2019-02-18 19:22:27
Java
Andres Iniesta, 2019-02-18 19:22:27

JSOUP: How to count the number of pages on a website?

Good afternoon!
Guys, I'm parsing a site like this: www.myurl.com/page/X
X is the number of the page from which I should extract all the cards.
From one page, I can pull pictures. No problem.
But here's how to change the link in a cycle (page/1 ; page/2 ; page/3), and run my code on these pages?
The problem is that I don't know how many pages there are on the site and it can increase over time as new pictures are added.
What do you guys recommend? how to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
al_gon, 2019-02-18
@al_gon

The most important thing is to save the next page and / or retrieve it correctly.
But since there is no concrete example, there is no concrete answer.

N
Ndochp, 2019-02-28
@Ndochp

Do the pictures run across the pages?
In such a simple scheme, we loop to 404 (or that the site responds to a non-existent page there) and remember the number to which they downloaded and the number of pictures on the last successful page. The next start is from the last page, from +1 picture. and again to 404.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question