Solution 1 :

Please try this:

Document doc = Jsoup.connect("https://hudebnibazar.cz/kytary/110000/").data‚Äč("p", "181").get();
Element e = doc.body();

because i can see here in the documentation that there is a method data used to set request parameters

Turns out it was the Website that has a problem/strange behavior, it’s been solved doing two request to the endpoint and adding the session cookie of the first one inside the second one

Problem :

I’m trying to get an html document of a specific from a URL with a page number query in it (“https://hudebnibazar.cz/kytary/110000/?p=181“). However, when I print out the result html, it always gives me the very first page.

Here’s the snippet:

Document doc = Jsoup.connect("https://hudebnibazar.cz/kytary/110000/?p=181").get();
Element e = doc.body();

Comments

Comment posted by Jan H

Still getting the same result

Comment posted by Alberto Sinigaglia

@JanH are you sure? sorry if i ask, how are you “checking” that the page you are getting is or is not the first one?

Comment posted by hudebnibazar.cz/kytary/110000/?p=181

@JanH if you use incognito mode on chrome, and you load “

Comment posted by Jan H

I see, I suppose there isn’t a way to programmatically simulate the reload process?

Comment posted by hudebnibazar.cz/kytary/110000/?p=180

@Berto99 is right. there is no page with number 181. I think when you try to open the link for the first time, the webpage is somehow not able to get the 181st page(because it doesn’t exist). But because of your first visit on the website, it shows you the first page because the webpage doesn’t want to send you a empty page. There are 4486 results on the webpage and results are grouped by 25. 4486 / 25 = 179.xx. you can reach =>

By