0

how to read next page of the same URL

the URL of the page contain many pages i read the first page using

URL(url).openStream()

but it just reading the first page

for example this site i read the first page how can i read the second culture.gov.uk/news/news_stories/6832.aspx

3
  • 1
    Dont ask duplicates of your own questions stackoverflow.com/questions/4438519/read-the-following-link, edit the first one and try to make it sensible Commented Dec 14, 2010 at 14:02
  • There is no such thing as the next page of an URL. An URL corresponds to one page. It could contain links to other pages, but that has nothing to do with the original URL. And there is no natural ordering, so it's impossible to tell which page is "next". Commented Dec 14, 2010 at 15:34
  • thanks for example this site i read the first page how can i read the second culture.gov.uk/news/news_stories/6832.aspx Commented Dec 14, 2010 at 15:53

2 Answers 2

1

Next page will have some link.

You can parse HTML and collect all the links and then you can filter out which is the next link for this page and then read it same way.

Here is the example that will list all the links from given page. - using JSOUP

Note: It is certainly ill-legal to do this for some sites.

Sign up to request clarification or add additional context in comments.

Comments

0

You will need the URL scheme for paging. For example it can be url + "?page=" + page. It depends on the site. Note that scraping is not always legal.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.