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
A BOT TO FIND ID OF A STICKER.

sticker id A BOT TO FIND ID OF A STICKER. THIS REPOSITORY HAVE TWO BRANCHES FOR DEPLOY WITH COMMAND & WITHOUT COMMAND. Mandatory variables API_ID - Ge

Ashik Muhammed 3 Dec 29, 2022
Script Crack Facebook, and Instagram 🚶‍♂

in-mbf Script Crack Facebook, and Instagram 🚶‍♂ Bukti Install Script $ pkg update && pkg upgrade $ pkg install git $ pkg install python2 $ pip2 insta

Yumasaa 5 Dec 27, 2021
A python library built on the API of the coderHub.sa, which helps you to fetch the challenges and more

coderHub A python library built on the API of the coderHub.sa, which helps you to fetch the challenges and more Installation • Features • Usage • Lice

TheAwiteb 5 Nov 04, 2022
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA

My solutions to adventofcode.com puzzles. I post videos of me solving the puzzles in real-time at https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41

195 Jan 04, 2023
Python based Spotify account generator.

Spotify Account Generator Python based Spotify account generator. Installation Download the latest release, open command prompt in the folder, run pip

polo 5 Dec 27, 2022
Python functions for opentargets.org API

What is opy_Targets? Opentargets.org uses GraphQL API to explore it's content via coding. This ensemble of functions aim is to make it easy to use the

1 Jan 10, 2022
Aplicação dos metodos de classificação em 3 diferentes banco de dados. Usando...

Machine Learning - Métodos de classificação Base de Dados utilizadas: Dados de crédito Dados do Census Métodos de classificação aplicados: Naive Bayes

1 Jan 18, 2022
A telegram bot which can show you the status of telegram bot

BotStatus-Ts-Bot An open source telegram Bot Status bot For demo you can check here The status is updated in every 1 hour About Bot This is a Bot stat

Ts_Bots 8 Nov 17, 2022
数字货币BTC量化交易系统-实盘行情服务器,虚拟币自动炒币-火币API-币安交易所-量化交易-网格策略。趋势跟踪策略,最简源码,可在线回测,一键部署,可定制的比特币量化交易框架,3年实盘检验!

huobi_intf 提供火币网的实时行情服务器(支持火币网所有交易对的实时行情),自带API缓存,可用于实盘交易和模拟回测。 行情数据,是一切量化交易的基础,可以获取1min、60min、4hour、1day等数据。数据能进行缓存,可以在多个币种,多个时间段查询的时候,查询速度依然很快。 服务框架

dev 258 Sep 20, 2021
Opencontactbook - Bulk-manage large numbers of vCard contacts with built-in geolocation

Open Contact Book Open Contact Book is a buiness-oriented, cross-platform, Pytho

Aurélien PIERRE 2 Aug 08, 2022
Indian Space Research Organisation API With Python

ISRO Indian Space Research Organisation API Installation pip install ISRO Usage import isro isro.spacecrafts() # returns spacecrafts data isro.lau

Fayas Noushad 5 Aug 11, 2022
Module to use some statistics from Spotify API

statify Module to use some statistics from Spotify API To use it you have to import the functions into your own project. You have also to authenticate

Miguel Cózar 2 Jun 02, 2022
A frame to create discord bots (for myself) that uses cogs, JSON, activities, and more.

dpy-frame A frame to create discord bots (for myself) that uses cogs, JSON, activities, and more. NOTE: Documentation is incomplete, so please wait un

Apple Discord 1 Nov 06, 2021
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

16 Oct 21, 2022
Github-Checker - Simple Tool To Check If Github User Available Or Not

Github Checker Simple Tool To Check If Github User Available Or Not Socials: Lan

ميخائيل 7 Jan 30, 2022
Ap lokit lokit

🎵 FANDA MUSIC BOT Fanda Music adalah proyek bot telegram yang memungkinkan Anda memutar musik di obrolan suara grup telegram. a href="https://www.py

Fatur 2 Nov 18, 2021
🔎 Hunt down social media accounts by username across social networks

Hunt down social media accounts by username across social networks Installation | Usage | Docker Notes | Contributing Installation # clone the repo $

Sherlock 38.2k Jan 01, 2023
vk Bot because of which everyone will lag

VK-crash-bot open cmd and write: "pip install vk-api" To configure the bot, you need to open main.py and set the value to such variables as "token" an

NotQuki 0 Jun 05, 2022
Tickergram is a Telegram bot to look up quotes, charts, general market sentiment and more.

Tickergram is a Telegram bot to look up quotes, charts, general market sentiment and more.

Alberto Ortega 25 Nov 26, 2022
A fun hangman style game to guess random movie names with a short summary about the movie.

hang-movie-man Hangman but for movies 😉 This is a fun hangman style game to guess random movie names from the local database and show some summary ab

Ankit Josh 10 Sep 07, 2022