S
S
Stepan Sidorov2020-01-23 17:54:13
Python
Stepan Sidorov, 2020-01-23 17:54:13

How to click the "Next" button on the site, and save the page with changes?

There is such a site: https://www.b17.ru.
It publishes posts about psychology, I wanted to parse headlines from it and send me a message to my desktop about new posts. I do this for practice in Python.
But here's the problem, not all new posts are displayed on the main page, but only the most popular ones, and to get to other posts you need to click the "Next" button.
That is, when I visit the main page using this code with BeautifulSoup


url = " https://www.b17.ru "
Site = rq.get(url)

I receive only popular articles.
Is it possible to do something like this:

if you can still click the "next" button:
click the "next" button
else:
save the page

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex1478, 2020-01-23
@alex1478

Look through the debug console in the browser what request goes to the site after clicking "Next". Repeat it in your program.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question