Git Product home page Git Product logo

craigslistscraper's People

Contributors

ryanirl 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

Watchers

 avatar

craigslistscraper's Issues

Exception when fetching an ad with no price

When fetching an ad such as this one https://web.archive.org/web/20240624234928/https://seattle.craigslist.org/est/syd/d/seattle-2023-apple-macbook-pro-m1-m2/7759193752.html, which does not list a price, the parser throws an error.

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "...", line 67, in queryItemsThreaded
    status = ad.fetch()
  File ".../.local/lib/python3.10/site-packages/craigslistscraper/ad.py", line 50, in fetch
    self.price = parser.price
  File ".../.local/lib/python3.10/site-packages/craigslistscraper/ad.py", line 93, in price
    return format_price(self.soup.find("span", class_ = "price").text)
AttributeError: 'NoneType' object has no attribute 'text

Seems like this could be fixed pretty easily by first checking if the page contains a price element before attempting to fetch it. Not sure what the ideal behavior is in the case there is no price though.

Craigslist Scraper not pulling anything with valid search criteria.

from craigslistscraper import Searches

if name == 'main': # Required to run inside of "if name == main"

filters = ['&postedToday=1'] # Optional | Define your filters here

cities = ['Denver','Miami'] # Required | Define the cities you want to search

car_data=False by default and doesn't need to be defined explicitly.

foo = Searches("Moving", cities, car_data=False)

foo.compile_search()

yields an empty json

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.