Web Scraping the Phillips India website — Scraping the Headphone Category.
Published: 2022-07-04 11:15:07


## Web Scraping the Phillips India website — Scraping the Headphone Category.

![Photo by [Iwona Castiello d'Antonio](https://unsplash.com/@aquadrata?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/8304/0*7ZI0nhI0bICoK6li)

Here I will scrape all the content on the Phillips website. And that content will be the Headphones category. The website is Phillips's India website.

Usually, web scraping is part of the Data Science/ Data Analyst job, which is the Data Generation or Data Aggregator.

Here we are going step by step approach, to how we do scraping the website, and the technology we are going to use is, Python, Selenium and Beautiful Soup.

First thing is that we are going to install some packages, which we type the certain command on cmd or anaconda prompt.
>  pip install lxml
>  pip install selenium
>  pip install beautifulsoup4
>  pip install pandas
>  pip install webdriver-manager
>  pip install regex

![](https://cdn-images-1.medium.com/max/2000/1*dHicG7rF6tV5vVtjFgX0eQ.png)

![](https://cdn-images-1.medium.com/max/2146/1*ON-EFSuptsQpeZ4gls3moQ.png)

First, we are going to import the packages we required.
{% gist https://gist.github.com/shoeb370/785656aa394e51cfda96d20f5516a0ca.js %}
What I will do, I visit directly to that website which contains all the headphones and which contain all the types of headphones. So that is easy for us to try not to do much to automate the website.

I have mentioned below that how our website looks and you can visit to have look at how this website looks for you. [https://www.philips.co.in/c-m-so/headphones/latest#](https://www.philips.co.in/c-m-so/headphones/latest#)

![](https://cdn-images-1.medium.com/max/2000/1*59XMWKyzsBZzVxIJeQXvEw.png)

First, what we do will scrape all the data present inside the small container or we can say a small box. I am going to extract the Model number, Category name, and Overall Ratings.
{% gist https://gist.github.com/shoeb370/a2a60c61a664501da27da61369150f8d.js %}
Line number 19 on the above code is to collect the links of the product. By collecting the links of the product to visit the product website and to collect the data like technical specifications in detailed format.

![](https://cdn-images-1.medium.com/max/2004/1*luRKV0-aObzGwxoGpqDEnA.png)

![](https://cdn-images-1.medium.com/max/2000/1*sk_1jit5T5OK47BEx4HbxQ.png)
{% gist https://gist.github.com/shoeb370/e3bae499ce2f8c1b64e14a315be21452.js %}
![](https://cdn-images-1.medium.com/max/2000/1*q4mQoMJoMG3Ya_fD4cNclQ.png)

![](https://cdn-images-1.medium.com/max/2000/1*8pyiLmRim82wUi4vE5WesA.png)

Now finally we scrape all the data, and end result is that we are going to save the data in CSV format.
{% gist https://gist.github.com/shoeb370/a44aed52aeb093f0666a8895ad2c80ce.js %}
![](https://cdn-images-1.medium.com/max/2000/1*Mc7BVNfJLf12y7fxoEMqCQ.png)

![](https://cdn-images-1.medium.com/max/2638/1*sHfZzSuj0LlwLFFUFkR9BQ.png)

Inside data look like the above image.

That file will be saved as “Final_Headphones.csv”

The entire code is shown below:
{% gist https://gist.github.com/shoeb370/3721d46e78156d511c91ddfef4f61abb.js %}
That’s all about scraping the data.

Thank you.