Skip to content
Advertisement

How to get HTML changes after pressing button with Beautiful Soup and Requests

I want to get the HTML this site https://www.forebet.com/en/football-predictions after pressing the button More[+] enough times to load all games. Each time the button More[+] on the bottom of the page the HTML changes and shows more football games. How do I get the request to the page with all the football games loaded?

JavaScript

Advertisement

Answer

Like stated, requests and beautfulsoup are used to parse data, not to interact with the site. To do that you need Selenium.

Your other option is to see if you can fetch the data directly, and see if there are parameters that can make another request as if you clicked the get more. Does this do the trick for you?

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement