开发者

java read a web page using url

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 t开发者_运维百科he 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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜