Skip to content
Advertisement

Python Scraping: Trying to scrape a specific data (phone details) according to user input

I am doing web scraping from www.gsmarena.com . i want to extract a specific data according to the user input. this code returns all the phone models and names, i want to extract just the samsung phones details with a specific input suck as the RAM,ROM,CPU and COLOR. help me please. thanks in advance.

JavaScript

Advertisement

Answer

I would advise you to play sometime with urls. In your case user may ask for a specific mobile phone manufacturer and target url would look like this:

JavaScript

Moreover, you are quite lucky because you can fetch a certain cell phone details without redirecting to it’s page. In your case each cell phone refers to anchor tag with a class name like this:

JavaScript

It means you can parse links that start from “Samsung” in order to filter the query according to the user’s needs:

JavaScript

To fetch CPU, RAM, e.t.c info you have to refer anchor tags:

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