Scraping Used Items on Craigslist.org with Scrapy

Keenan Burke-Pitts
Posted on Jun 11, 2018

Purpose

Why I Chose This Project

As the old adage goes, ‘One man’s trash is another man’s treasure.’  This was my first introduction to Scrapy. My goal was to scrape used items from Craigslist.org and perform some basic EDA on the data.

I expanded this project into more detail in my final project. You can check out if you’re interested https://nycdatascience.com/blog/student-works/capstone/local-used-items-analysis-with-python-and-tableau.

Questions to Answer

I set out to answer what type of items were available, where the items were located, and how many items there were for each popular location. I also wanted to find out what the price distribution was for the items in the popular locations.

Process

Where and How I Extracted the Data

Using Scrapy

This spider scraped the first page of the used items for sale section. This dataset a small sample of what items were actually available on Craigslist in the area. I decided to go this route because I knew that Craigslist blocks IP addresses if they notice unusual request activity they deem inappropriate. I scraped the entire used items for sale section in my final project, but that required using the paid Crawlera service from Scrapinghub.com. Because this was my first exploration into web scraping, I focused on the fundamentals of creating a Scrapy spider and performing EDA on the data.

https://gist.github.com/Kiwibp/f5582e790ab1b391318bf921482e9a15

How I Visualized The Data

Using Pandas, Matplotlib, and Seaborn

I was able to resolve the questions I set out to answer using Pandas to clean and analyze the data as well as Matplotlib and Seaborn to visualize the data. I created subsets of items to group high-priced motor vehicles together as well as popular locations so I could gain insight into the price distribution of subsets.

https://gist.github.com/Kiwibp/a064f31e9a4aa776718a84832606e01f

 

https://gist.github.com/Kiwibp/3d10e4e285ecf2d16a191ab8680d2d4d

Using wordcloud

I decided to add a simple word cloud visualization as well for another helpful visualization of available items in the area.

https://gist.github.com/Kiwibp/2cab95793a7bf55050184e7de8331f2e

Results

Insights Gleaned

This sample-sized dataset was too small for a confident understanding of the price distributions for all used items in the area. But I was able to determine that $1000 would be enough to buy the majority of items available that weren’t motor vehicles.

This was my first introduction to data wrangling and EDA with Python and I enjoyed the learning process. You can view my GitHub repo here: https://github.com/Kiwibp/NYC-DSA-Bootcamp--Web-Scraping.

About Author

Keenan Burke-Pitts

Keenan Burke-Pitts

Keenan has over 3 years of experience communicating and assisting in software and internet solutions to clients. Moving forward, Keenan plans to leverage his technical abilities, communication skills, and business understanding in the digital marketing world. Keenan graduated...
View all posts by Keenan Burke-Pitts >

Leave a Comment

Avatar
Web Scraping Craigslist Items With Python | Adventures In Analytics August 4, 2019
[…] can view my guest post on the NYC Data Science Academy […]

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp