GithubHelp home page GithubHelp logo

cnov20 / clcarstrucks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lienmeat/clcarstrucks

0.0 1.0 0.0 13 KB

Craigslist cars and trucks search data scraper and google sheets importer

Python 88.04% Shell 11.96%

clcarstrucks's Introduction

clcarstrucks

Craigslist cars and trucks search data scraper and google sheets importer

Getting started

You should set this up in a virtualenv, which you should be able to install in a few commands (instructions vary by OS).

  1. then do virtualenv env and then source env/bin/activate to create and activate a python virtualenv
  2. pip install -r requirements.txt to install the project's python dependencies

At this point you should have everything you need to scrape craigslist working to a point where you can generate .csv files on your local machine.

Try running this as a test:

scrapy runspider clcarstrucks.py -o test.csv -a city=seattle -a auto_make_model="honda fit" -a auto_title_status=1 -a auto_transmission=2 -a max_auto_miles=10000 -a min_auto_year=2011 -a postal=98133 -a search_distance=10

If you see a few results in test.csv, you should be good to start hacking around with the search arguments, or editing clcarstrucks.py to your particular needs.

If you wish to import the .csv results into a google sheets document, a bit more setup is required.

  1. Go to the google cloud console dashboard and create a new project
  2. Create Oauth client ID credential and follow any prompts. Besides "product name" on the oauth consent screen, you can leave it as defaults to get up and running, and save to get to the actual credential creation.
  3. For the "Application type" select "other" name it anything you want, and save.
  4. Download the JSON secrets file for this credential to the project directory, and rename it client_secret.json. screenshot
  5. Go back to the google cloud console dashboard and enable both the Google Drive API and the Google Sheets API for this project.

Now, you should be able to go end to end with this! Try ./run.sh and see if you get an oath2 consent screen after a bit in your browser (on localhost:8080). If so, there should be a clcarstrucks document in google sheets!

If you wish to do any analysis on the data in sheets, I recommend creating another sheets document that references the clcarstrucks document using the =IMPORTRANGE() function so that future scrapes don't destroy your work. =IMPORTRANGE("https://docs.google.com/spreadsheets/d/SOME_DOCUMENT_ID_HERE", "clcarstrucks!A1:Z5000")

clcarstrucks's People

Contributors

lienmeat 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.