Skip to content
Advertisement

Web Scraping – URL extraction from Lazada ecommerce platform

I am currently trying to scrape the products URLs from Lazada ecommerce platform, however i am getting random links from the website rather than the products links.

https://www.lazada.com.my/oldtown-white-coffee/?langFlag=en&q=All-Products&from=wangpu&pageTypeId=2

My code below:

JavaScript

The result I am getting out of this code(which is not what i want) :

enter image description here

This is the section of the links that I need, i wanted to list down all the products URLs from the products page.

enter image description here

I hope you guys can help me on this, I know it is simple it just doesn’t seems to work, have been looking at this since yesterday.

Advertisement

Answer

The page is dynamic. Within the html source code is the script that generates a json format of the products. You can pull that, then parse the json object to print off the urls:

JavaScript

Output:

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