Git Product home page Git Product logo

craigslist-scraper's Introduction

Craigslist Bot

This app scrapes the craigslist website for each city/zone across the US and plots a circle of a size with relation to the price of the item for that area. The larger the circle: the higher the price. Data below is for the iPhone X as of March 2020.


Install:

(best if copy and pasted into a jupyter notebook)

  1. Clone, fork, or download this repository
  2. pip install requirements.txt
  3. If you do not have a Google API key, don't worry, I have already compiled that data in step 5.
  4. Save a google api key as an environment variable and use that key variable name in the code. Can be done temporarily from the terminal this way: export GOOGLE_API_KEY=yourapikeyhere // Check to make sure it was saved with: echo $GOOGLE_API_KEY // This should return your key
  5. This code has a few different functions, one of which returns the latitudes and longitudes of every city using Google's API service. However I already have created that file "cities_and_latlongs.csv" so we do not need to run this function again.
6. Configuring Specifications(product to search for): in pricesDFrame() there's a dictionary search_params which contains the data we search craigslist for in the exact speficications, toggle these to configure your search results. Change the 'query' to the product and anything with a '-' sign in front of it will be removed from the search candidates.
7. Running the Program: pass cityDict() into pricesDFrame() // pricesDFrame(cityDict()) // upon running this piece of code which calls the two functions we should now have a file called 'craigslist_data_copy.csv'. The function

  • Scrapes the data of every craigslist site in the US for an item with given parameters

  • Creates a pandas DataFrame with the price of the item and its city

  • Retrieves lat and long for each city via Google Maps API

  • Plots the mean price for each city (eliminating extremes) on a map of the US

  • The larger the circle - the higher the price.

Maps plotted with Bokeh

Alt text

Alt text

Alt text

craigslist-scraper's People

Contributors

samiringley avatar

Stargazers

 avatar

Watchers

James Cloos avatar

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.