ryanirl / craigslistscraper Goto Github PK
View Code? Open in Web Editor NEWSimple webscraper for Craigslist.
License: MIT License
Simple webscraper for Craigslist.
License: MIT License
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.
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
foo = Searches("Moving", cities, car_data=False)
foo.compile_search()
yields an empty json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.