Giter VIP home page Giter VIP logo

mobile-phone-dataset-gsmarena's Introduction

Mobile-Phone-Dataset-GSMArena

This is Python script which scrape the GSMArena website mobile phones specification and save in the csv format files.

Prerequisites

  • Python3.x
  • Pip

Installing

  • Install reqiurement text file using pip3

    pip3 install -r requirements.txt
    

Running

Run this command on your terminal

python3 gsmarena_scraping.py

Built With

  • Beautifulsoup4 - Beautifulsoup4 python librabry for website scraping.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

mobile-phone-dataset-gsmarena's People

Contributors

0810nitesh avatar deepakchawla avatar dependabot[bot] avatar ixaxaar avatar sahil-ajmera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mobile-phone-dataset-gsmarena's Issues

List Index out of range

Hi All,

I am new to python if anyone can support !
First on running this code i faced the issue of 'pwd' since i am running on windows not Linux and i followed the solution proposed in another ticket by replacing 'pwd with 'cd'

Then another error came of "list index out of range" as below:

in save_specification_to_file(self)
119 # This function save the devices specification to csv file.
120 def save_specification_to_file(self):
--> 121 phone_brand = self.crawl_phone_brands()
122 self.create_folder()
123 files_list = self.check_file_exists()

in crawl_phone_brands(self)
43 phones_brands = []
44 soup = self.crawl_html_page('makers.php3')
---> 45 table = soup.find_all('table')[0]
46 table_a = table.find_all('a')
47 for a in table_a:

IndexError: list index out of range

Is that because too many request? any idea? can anyone help solve that?

Unicode support missing

The script crashes when it encounters Unicode data.
Changing line 134 to with open(self.absolute_path + '/' + brand[0].title() + ".csv", "w",encoding='utf-8-sig',newline='') as file: will add Unicode support.

Not completely native Python code since it uses pwd, thus not working on Windows

Please change the following line:
line 20: self.absolute_path = os.popen('pwd').read().strip() + '/' + self.new_folder_name # It create the absolute path of the GSMArenaDataset folder.

new code:
self.absolute_path = os.path.dirname(os.path.realpath(__file__)) + '/' + self.new_folder_name # It create the absolute path of the GSMArenaDataset folder.

List index out of range error

Hey, I was trying to use the library and encountered the following error when I did a python gsmarena_scraping.py

  File "gsmarena_scraping.py", line 154, in <module>
    obj.save_specification_to_file()
  File "gsmarena_scraping.py", line 120, in save_specification_to_file
    phone_brand = self.crawl_phone_brands()
  File "gsmarena_scraping.py", line 44, in crawl_phone_brands
    table = soup.find_all('table')[0]
IndexError: list index out of range

I'm new to web scraping (and python in general), any pointers would be super helpful, thanks!

Scrap with Brand without ASC

Hello,
This script scraping brands with ASC
for complete files need meny time

How we can scrap brand individual?

Just I need scrap Samsung but it starting with acer

Thank you

NoneType object has no attribute 'text'

Traceback (most recent call last):
File "scrape.py", line 155, in
obj.save_specification_to_file()
File "scrape.py", line 131, in save_specification_to_file
datum = self.crawl_phones_models_specification(value, brand[0])
File "scrape.py", line 77, in crawl_phones_models_specification
model_name = soup.find(class_='specs-phone-name-title').text
AttributeError: 'NoneType' object has no attribute 'text'

'pwd' is not recognized as an internal or external command,

GSMArenaDataset directory already exists
Traceback (most recent call last):
File "gsmarena_scraping.py", line 149, in
obj.save_specification_to_file()
File "gsmarena_scraping.py", line 121, in save_specification_to_file
files_list = self.check_file_exists()
File "gsmarena_scraping.py", line 115, in check_file_exists
return os.listdir(self.absolute_path)
FileNotFoundError: [WinError 3] Sistem belirtilen yolu bulamıyor: '/GSMArenaDataset'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.