Skip to content

scrapeVehicles.py Not fully stripping the prices #1

@trepersec

Description

@trepersec

TLDR; the price is being stripped of the dollar sign ($), but no the comma (,). e.g. $2,500 -> 2,500 = error

System: Ubuntu 18.04.5 LTS
Code/Commit Version: Jan 20, 2019

Thanks for making this available! Going through your docs and ran installed it according to instructions. Ran crawlCities.py and finished in 25 seconds. Went to run scrapeVehicles.py, but then it fails with the following error:

Scraping vehicles from [city], 29 cities remain
Gathering entries 0 through 120
0 entries tossed due to inadequate data
Traceback (most recent call last):
  File "scrapeVehicles.py", line 286, in <module>
    main()
  File "scrapeVehicles.py", line 282, in main
    runScraper()
  File "scrapeVehicles.py", line 110, in runScraper
    vehicleDict["price"] = int(item[1].strip("$"))
ValueError: invalid literal for int() with base 10: '2,500'

Suggested fix (or something along these lines because this allows me to run the code):
scrapeVehicles.py @ line 110
FROM : vehicleDict["price"] = int(item[1].strip("$"))
TO : vehicleDict["price"] = int(item[1].replace('$', '' ).replace(',', '' ))

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions