SCRAPING DYNAMIC WEBPAGES

Akash_freeflow
2 min readDec 19, 2020

PREREQUISITES:

Before moving ahead, we need to make sure that we have imported the bs4 library onto the python environment we are working on. Moving ahead dynamic web pages are such that they scroll on and on without displaying the page number button which would actually be present on that page, in this article I have briefed about how we can handle this situation while extracting data.

What would be the problem with this?

When scraping data, we often tend to use URL to move from one page to the other and pull data from there, we then create a beautiful soup object of each page and extract the need text after parsing the information from the beautiful soup object, now as we do not have access to the URL with page number, we face trouble while accessing the page elements. Moving ahead..

Now turn off the internet connection of your pc and scroll down, now you can see the page buttons on the webpage, click on any one of these page buttons and see the URL change now you can loop through the URL just by changing the page number.

Pay attention to how the URL has changed, now it has a new attribute, page_number available.

Hope this article helped you!

For more such content follow Akash_freeflow on Medium!

--

--

Akash_freeflow

Chemical Engineer, Data science enthusiast, AI engineering Intern, Language trainer.