Simple Craigslist wrapper

Overview

python-craigslist

A simple Craigslist wrapper.

License: MIT-Zero.

Disclaimer

  • I don't work for or have any affiliation with Craigslist.
  • This module was implemented for educational purposes. It should not be used for crawling or downloading data from Craigslist.

Installation

pip install python-craigslist

Classes

Base class:

  • CraigslistBase

Subclasses:

  • CraigslistCommunity (craigslist.org > community)
  • CraigslistHousing (craigslist.org > housing)
  • CraigslistJobs (craigslist.org > jobs)
  • CraigslistForSale (craigslist.org > for sale)
  • CraigslistEvents (craigslist.org > event calendar)
  • CraigslistServices (craigslist.org > services)
  • CraigslistGigs (craigslist.org > gigs)
  • CraigslistResumes (craigslist.org > resumes)

Examples

Looking for a room in San Francisco?

from craigslist import CraigslistHousing
cl_h = CraigslistHousing(site='sfbay', area='sfc', category='roo',
                         filters={'max_price': 1200, 'private_room': True})

# You can get an approximate amount of results with the following call:
print(cl_h.get_results_approx_count())

992

for result in cl_h.get_results(sort_by='newest', geotagged=True):
    print(result)

{
    'id': u'4851150747',
    'name': u'Near SFSU, UCSF and NEWLY FURNISHED - CLEAN, CONVENIENT and CLEAN!',
    'url': u'http://sfbay.craigslist.org/sfc/roo/4851150747.html',
    'datetime': u'2015-01-27 23:44',
    'price': u'$1100',
    'where': u'inner sunset / UCSF',
    'has_image': False,
    'has_map': True,
    'geotag': (37.738473, -122.494721)
}
# ...

Maybe a software engineering internship in Silicon Valley?

from craigslist import CraigslistJobs
cl_j = CraigslistJobs(site='sfbay', area='sby', category='sof',
                      filters={'is_internship': True, 'employment_type': ['full-time', 'part-time']})

for result in cl_j.get_results():
    print(result)

{
    'id': u'5708651182',
    'name': u'GAME DEVELOPER INTERNSHIP AT TYNKER - AVAILABLE NOW!',
    'url': u'http://sfbay.craigslist.org/pen/eng/5708651182.html',
    'datetime': u'2016-07-30 13:30',
    'price': None,
    'where': u'mountain view',
    'has_image': True,
    'has_map': True,
    'geotag': None
}
# ...

Events with free food in New York?

from craigslist import CraigslistEvents
cl_e = CraigslistEvents(site='newyork', filters={'free': True, 'food': True})

for result in cl_e.get_results(sort_by='newest', limit=5):
    print(result)

{
    'id': u'4866178242',
    'name': u'Lituation Thursdays @ Le Reve',
    'url': u'http://newyork.craigslist.org/mnh/eve/4866178242.html',
    'datetime': u'1/29',
    'price': None,
    'where': u'Midtown East',
    'has_image': True,
    'has_map': True,
    'geotag': None
}
# ...

Where to get filters from?

Every subclass has its own set of filters. To get a list of all the filters supported by a specific subclass, use the .show_filters() class-method:

>>> from craigslist import CraigslistJobs, CraigslistForSale
>>> CraigslistJobs.show_filters()

Base filters:
* posted_today = True/False
* query = ...
* search_titles = True/False
* has_image = True/False
Section specific filters:
* is_internship = True/False
* is_telecommuting = True/False
* is_contract = True/False
* is_parttime = True/False
* is_nonprofit = True/False
* employment_type = u'full-time', u'part-time', u'contract', u"employee's choice"

>>> CraigslistForSale.show_filters(category='cta')

Base filters:
* posted_today = True/False
* query = ...
* search_titles = True/False
* has_image = True/False
Section specific filters:
* min_year = ...
* model = ...
* min_price = ...
* max_miles = ...
* make = ...
* max_price = ...
* min_miles = ...
* max_year = ...
* auto_title_status = u'clean', u'salvage', u'rebuilt', u'parts only', u'lien', u'missing'
* auto_transmission = u'manual', u'automatic', u'other'
* auto_fuel_type = u'gas', u'diesel', u'hybrid', u'electric', u'other'
* auto_paint = u'black', u'blue', u'brown', u'green', u'grey', u'orange', u'purple', u'red', u'silver', u'white', u'yellow', u'custom'
* auto_bodytype = u'bus', u'convertible', u'coupe', u'hatchback', u'mini-van', u'offroad', u'pickup', u'sedan', u'truck', u'SUV', u'wagon', u'van', u'other'
* auto_drivetrain = u'fwd', u'rwd', u'4wd'
* auto_size = u'compact', u'full-size', u'mid-size', u'sub-compact'
* auto_cylinders = u'3 cylinders', u'4 cylinders', u'5 cylinders', u'6 cylinders', u'8 cylinders', u'10 cylinders', u'12 cylinders', u'other'
* condition = u'new', u'like new', u'excellent', u'good', u'fair', u'salvage'

Where to get site and area from?

When initializing any of the subclasses, you'll need to provide the site, and optionall the area, from where you want to query data.

To get the correct site, follow these steps:

  1. Go to craigslist.org/about/sites.
  2. Find the country or city you're interested on, and click on it.
  3. You'll be directed to <site>.craigslist.org. The value of <site> in the URL is the one you should use.

Not all sites have areas. To check if your site has areas, check for links next to the title of the Craigslist page, on the top center. For example, for New York you'll see:

https://user-images.githubusercontent.com/1008637/45307206-bb404d80-b51e-11e8-8e6d-edfbdbd0a6fa.png

Click on the one you're interested, and you'll be redirected to <site>.craigslist.org/<area>. The value of <area> in the URL is the one you should use. If there are no areas next to the title, it means your site has no areas, and you can leave that argument unset.

Where to get category from?

You can additionally provide a category when initializing any of the subclasses. To obtain the code of this category, follow these steps:

  1. Go to <site>.craigslist.org or just craigslist.org (you'll be directed to the last used site).
  2. You'll see a list of categories and subcategories (see image below).
  3. Click on the interested subcategory. You'll be redirected to the search view for that subcategory. The URL you were redirected will end with /search/<category>. This would be the code for your category.

https://user-images.githubusercontent.com/14173022/46252889-3614ce00-c424-11e8-9bac-060c236b8b58.png

Is there a limit for the number of results?

Yes, Craigslist caps the results for any search to 3000.

Support

If you find any bug or you want to propose a new feature, please use the issues tracker. I'll be happy to help you! :-)

Owner
Julio M. Alegria
Julio M. Alegria
Instagram auto reporting tool 100% working

INSTA REPORTER Instagram auto reporting tool 100% working Description this tool is made by Guccifer Shubham (shubhushubhu99) and by using this tool yo

Guccifer Shubham 26 Dec 28, 2022
DEPRECATED - Official Python Client for the Discogs API

⚠️ DEPRECATED This repository is no longer maintained. You can still use a REST client like Requests or other third-party Python library to access the

Discogs 483 Dec 31, 2022
Fetch the details of assets hosted on AWS.

onaws onaws is a simple tool to check if an IP/hostname belongs to the AWS IP space or not. It uses the AWS IP address ranges data published by AWS to

Amal Murali 80 Dec 29, 2022
A compatability shim between Discord.py and Hikari.

Usage as a partial shim: import discord import hikari import hikari_shim dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=

EXPLOSION 3 Dec 25, 2021
Telegram Bot to store Posts and Documents and it can Access by Special Links.

Telegram Bot to store Posts and Documents and it can Access by Special Links. I Guess This Will Be Usefull For Many People..... 😇 . Features Fully cu

REX BOTZ 1 Dec 23, 2021
PyManGenerator is a token generator for discord, it joins servers using webbot to automate everything

PyManGenerator is a token generator for discord, it joins servers using webbot to automate everything. Captcha can be done by itself unless you used your current IP Address more than once.

5 Nov 27, 2021
Um bot simples para seguir as pessoas

Um bot simples para seguir pessoas no instagram, criado apeanas para testes. Utilizando o framework "Selenium", criei um bot para entrar em uma conta

Mobben 1 Nov 05, 2021
Minimal telegram voice chat music bot, in pyrogram.

VCBOT Fully working VC (user)Bot, based on py-tgcalls and py-tgcalls-wrapper with minimal features. Deploying To heroku: Local machine/VPS: git clone

Aditya 33 Nov 12, 2022
A self hosted slack bot to conduct standups & generate reports.

StandupMonkey A self hosted slack bot to conduct standups & generate reports. Report Bug · Request Feature Installation Install already hosted bot (Us

Muhammad Haseeb 69 Jan 01, 2023
A mass account list editor for python

Account-List-Editor This is an mass account list editor Usage Run the editor.py file with python (python3 ./editor.py) Press a button (1/2) and drag &

ExtremeDev 1 Dec 20, 2021
Asynchronous Python Wrapper for the GoFile API

Asynchronous Python Wrapper for the GoFile API

Gautam Kumar 22 Aug 04, 2022
LOL-banner - A discord bot that bans anybody playing league of legends

LOL-banner A discord bot that bans anybody playing league of legends This bot ha

bsd_witch 46 Dec 17, 2022
Monitor robot of Apple Store's products, using DingTalk notification.

概述 本项目应用主要用来监测Apple Store线下直营店货源情况,主要使用Python实现。 首先感谢iPhone-Pickup-Monitor项目带来的灵感,同时有些实现也直接使用了该项目的一些代码。 本项目在iPhone-Pickup-Monitor原有功能的基础上去掉了声音通知,但添加了多

Lennon Chin 159 Dec 09, 2022
Free TradingView webhook alert for basic plan users.

TradingView-Free-Webhook-Alerts Project start on 01-02-2022 Providing the free webhook service to the basic plan users in TradingView. Portal ↠ Instal

Freeman 31 Dec 25, 2022
A qq bot based on nonebot2 and go-cqhttp

Asoul-bot A qq bot based on nonebot and go-cqhttp 你可以将bot部署在本地,也可以加入bot测试群:784280070(全体禁言) 你可以通过临时会话的方式向bot发送指令,输入help获取帮助菜单 本地部署请参考:https://zhuanlan.

11 Sep 23, 2022
Updater for PGCG (Paradox Game Converters Group) converters written in Python.

Updater Updater for PGCG (Paradox Game Converters Group) converters written in Python. Needs to be put inside an "Updater" directory in the root conve

Paradox Game Converters 2 Jan 10, 2022
Python client for Invidious' JSON API

Python project template A template for new Python projects. Features Automatically builds PDoc documentation & uploads package to PyPI on new GitHub r

Kevo 2 Jun 05, 2022
Validate all your Customer IAM Policies against AWS Access Analyzer - Policy Validation

✅ Access Analyzer - Batch Policy Validator This script will analyze using AWS Access Analyzer - Policy Validation all your account customer managed IA

Victor GRENU 41 Dec 12, 2022
This is an Advanced Calculator maybe with Discord Buttons in python.

Welcome! This is an Advanced Calculator maybe with Discord Buttons in python. This was the first version of the calculator, made for my discord bot, P

Polsulpicien 18 Dec 24, 2022
A Telegram Bot to Extract Various Types Of Archives

IDN Unzip Bot A Telegram Bot to Extract Various Types Of Archives Features Extract various types of archives like rar, zip, tar, 7z, tar.xz etc. Passw

IDNCoderX 8 Jul 25, 2022