Skip to main content

Free Stuffs!

This is a Python 3.x package which scrapes free stuff from Craigslist. freestuffs is under the MIT license. Check out the source code and the docs.

  • Using StuffScraper one can gather a list of free stuffs.

  • Using StuffCharter, one can create an HTML map of the free stuffs.

This package can be used to create a web application, such as the Treasure-map (source), or for use on Twitter.

Installation

freestuffs can be installed with pip:

pip install freestuffs

The package has the following dependencies which are automatically installed by pip:

  • beautifulsoup4

  • bs4

  • folium

  • geopy

  • requests

  • Unidecode

Additionally, these may be manually installed using pip with pip install -r requirements.txt.

Getting Started

Stuffs

The stuff class corresponds to a Craiglist free stuff posting. It’s basic characteristics include title and location. Notably, there is no price attribute. If the posting has no image, the Wikipedia no-image image is used in it’s place.

>>> from freestuffs.stuff_scraper import StuffScraper
>>> stuffs = StuffScraper('montreal', 5).stuffs
>>> print(stuffs[0])
what: free shelves
 where: Workman St, montreal
 link: http://montreal.craigslist.ca/zip/5629811181.html
 image: https://images.craigslist.org/00r0r_4p06sM5Hn4O_300x300.jpg

Scape Stuffs

The StuffScraper class will scrape Craiglist for free stuff.

>>> from freestuffs.stuff_scraper import StuffScraper
>>> stuffs = StuffScraper('montreal', 5).stuffs # precise=False
>>> print(stuffs[0].thing)  # Title
Meubles / furniture

In order for the scraper to automatically scrape for latitude and longitude coordinates, pass in the parameter precise=True into the constructor.

>>> from freestuffs.stuff_scraper import StuffScraper
>>> stuffs = StuffScraper('montreal', 5, precise=True).stuffs
>>> print(stuffs[0].coordinates)
['45.617854', '-73.633931']

Chart Stuffs

The StuffCharter class will produce a folium Map object populated with free stuff from the StuffScraper.

>>> from freestuffs.stuff_scraper import StuffScraper
>>> from freestuffs.stuff_charter import StuffCharter
>>> stuffs = StuffScraper('montreal', 5, precise=True).stuffs
>>> stuffs_chart = StuffCharter(stuffs)
call save_map(path) generate html map
>>> type(map.treasure_map)
<class 'folium.folium.Map'>

The StuffCharter object is a wrapper around the folium.Map. Call save_map(HTML_PATH, CSS_PATH)

>>> stuffs_chart.save_map('webmap', 'static/style.css')

This function creates a directory if it is not found in the path. Call instead save_test_map() to generate an HTML map in the current directory.

Legend

  • The smaller the posting, the older it is.

  • The darker the border, the higher the amount of overlap.

Triage

The triage checks for regex search in this order:

  1. Red are furniture - wood, shelf, shelves, table, chair, scrap, desk.

  2. Blue are electronics: tv, sony, ecran, speakers, wire, electronic, saw, headphones, arduino.

  3. Black are the “desired” stuffs: book, games, cool, guide, box.

  4. White is default (no regex search matches).

Support

The easiest way to get support is to open an issue on Github.

Release files for freestuffs 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for freestuffs 0.1.6
File Size Uploaded
freestuffs-0.1.6.tar.gz 18.0 kB Details

Release files / freestuffs-0.1.6.tar.gz

Download URL freestuffs-0.1.6.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2bac86d08d38ad00469b6f97a25fe001df830b5b0f657e6d503058153f44f395
BLAKE2b-256 checksum
How to use checksums
aa1ed49ac07310a3e9deb206fde136415db3627b9a13cefd7fca3c327168c261
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page