<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aaron Langley on Medium]]></title>
        <description><![CDATA[Stories by Aaron Langley on Medium]]></description>
        <link>https://medium.com/@aarongjlangley?source=rss-d98a4b98a998------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IC2ThsuA9IBNwwBQF_1OZA.jpeg</url>
            <title>Stories by Aaron Langley on Medium</title>
            <link>https://medium.com/@aarongjlangley?source=rss-d98a4b98a998------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:34:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aarongjlangley/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Get Your Own Data — Building a Scalable Web-Scraper with AWS]]></title>
            <link>https://medium.com/data-science/get-your-own-data-building-a-scalable-web-scraper-with-aws-654feb9fdad7?source=rss-d98a4b98a998------2</link>
            <guid isPermaLink="false">https://medium.com/p/654feb9fdad7</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Aaron Langley]]></dc:creator>
            <pubDate>Wed, 29 Jul 2020 16:26:04 GMT</pubDate>
            <atom:updated>2020-07-30T02:42:37.626Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I built a Scalable Web-Scraper with AWS</h3><h4>My proposal for a fully managed cloud-based Python scraper</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xOvdhYEVL9XjJOc5" /><figcaption>How I imagine my AWS console… (Photo by <a href="https://unsplash.com/@patrykgradyscom?utm_source=medium&amp;utm_medium=referral">Patryk Grądys</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Early last year, I found a crazy deal on a used car from Craigslist. After double checking that it was not a scam (it was not). I naturally went straight to Kelly Blue Book to get the “real value” of my new car — but this got me thinking:</p><blockquote>How does Kelly Blue Book calculate Private-Party car values? On what grounds do I trust them?</blockquote><p>It seems that the first resource they must use is Craigslist — since this is the most popular peer-to-peer used car listing platform (and <em>only</em> major platform, until recently). if this is the case, Kelly-Blue-Book must somehow have access to Craigslist data. Craigslist does not offer an API, however, nor do they open their datasets (assuming they have any) to the public. This left me with a thought that perhaps companies like KBB are scraping some of their data (probably a safe guess).</p><p>Therefore, I decided to collect data to build my own Kelly-Blue-Book-esque platform. To do this, I needed to build a scraper with these requirements:</p><ol><li>Easily-scalable and dynamic scraper to accommodate the many Craigslist cities, listings, and listing-types.</li><li>Managed processing of hundreds of jobs per day — staggered and carefully scheduled in order to not DDoS Craigslist servers (or get blocked by them).</li><li>Monitoring of each job to immediately notify me of any runtime failures.</li><li>And lastly, CI/CD to manage rapid deployments of all services involved.</li></ol><p>Here’s a high-level diagram of my solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m4PJPeC3ppzMPgS5t0h1Gg.png" /><figcaption>Image by author</figcaption></figure><p>Essentially, I needed to build an ETL pipeline to collect Craigslist data on a daily basis, in order record the lifespan and events (price changes, de-listings) of every car listing. This article focuses on the extraction process of this data. I will be writing more on how I transform/load and process the data in the coming weeks (sneak-peek at some results later — keep reading!).</p><p><strong>Disclaimer</strong>: Please understand that this project is built for research only. While it has the capability of hitting Craigslist with thousands of requests in a very short time (or crashing your computer), I have been careful to limit the number of requests in a given time by strategically spacing the jobs so as to not spam/DDoS Craigslist servers. <strong>If you are scraping Craigslist (or any site for that matter), be sure to read and adhere to the </strong><a href="https://craigslist.org/robots.txt"><strong>robots.txt</strong></a><strong>.</strong></p><h3>Let’s dive right in…</h3><p>While I won’t be going step-by-step through the the whole process tutorial-style; I do want to give you an idea of how the scraper itself works.</p><p>The scraper is run inside a Docker container — the code itself is very simple, you can find the whole project <a href="https://github.com/aaronglang/cl_scraper">here</a>. It is built in Python and uses the <a href="https://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> library.</p><p>There are several environment variables passed to the scraper. These variables define the search parameters of each job. Essentially, the container’s lifecycle follows these three steps:</p><ol><li>The container is passed a few variables, primarily, the City/search-region, and the vehicle Make.</li><li>The container searches Craigslist based on parameters given and generates structured results from the HTML.</li><li>The container sends these results to S3 in CSV format.</li></ol><h3>Process and Infrastructure</h3><p>Here’s the cool part…</p><p>Now let’s go over the extraction/scheduling process in detail.</p><ol><li>Every day, my AWS <strong>CloudWatch</strong> event rules trigger lambdas to dispatch scraping jobs for different sets of states and vehicle makes.</li><li><strong>Lambda</strong> dispatchers submit jobs per-city to AWS Batch.</li><li>AWS <strong>Batch</strong> spins up the compute environment (<strong>ECS</strong>) and runs jobs according to the environment’s configuration (compute environment determines job concurrency — read more about AWS Batch <a href="https://aws.amazon.com/batch/">here</a>).</li><li><strong>CloudWatch</strong> processes and notifies on failures as Batch sends status updates.</li><li>At the end of each Batch job, the scraper will send a newly generated CSV of search-results to my <strong>S3</strong> bucket under the naming convention: searchtype_make_city_timestamp.csv. I chose to put the “make” before “city” since the make is more important to the price and lifespan of the vehicle listing.</li></ol><p>Here’s a high-level diagram of the scraping process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CxDVP9138M_iB4Rnnwd9tw.png" /><figcaption>Image by author</figcaption></figure><p>As you see from the diagram, I am using CloudWatch, Lambda, Batch, S3. I am also using SNS for notifications triggered by the “Batch-Jobs-Monitor.”</p><p>Here is my reasoning for the services I chose:</p><p><strong>CloudWatch</strong> has “Rules” which behave as Cron Jobs and can pass JSON payloads to lambda functions. This enabled me to submit multiple CloudFormation Templates with job parameters in JSON format as the to be executed according to the pre-determined Cron expressions.</p><p><strong>Lambda</strong> is fantastic for the smaller tasks (dispatch and notifications), and integrates easily with almost every Amazon service.</p><p><strong>AWS Batch</strong> is perfect for my scraper container. I had decided to run jobs on a per-city bases, which meant thousands of requests over a relatively short period of time. To speed-up each job, I decided on multithreading the requests in my python scraper. This meant I needed a service that would allow for long runtimes, and a high I/O rate. Lambda was out of the question due to these conditions (and Lambda does not support Python’s multi-threading packages). I found that AWS Batch was perfect — I was able to configure the compute environments to fit my needs (and budget), while having an easily maintainable Dockerized scraper in a pay-per-use service. Another major perk is that AWS Batch uses ECS to run the jobs, therefore, every time a new queue is processed, AWS Batch spins up new EC2 instances — <strong>with new IP addresses</strong> (essentially rotating IP’s).</p><p><strong>S3… </strong>Well S3 is a quick and inexpensive way to temporarily store my semi-structured scraper-results in an accessible location. I did have to be thoughtful of my object-naming standards. S3 buckets can get messy with hundreds of thousands of objects if naming-standards are not taken into consideration— the AWS SDK’s do not provide robust object-searching capabilities. Soon, I will be migrating my data out of S3 and into a structured relational database.</p><p><strong>SNS </strong>is great for the few text-notifications I need to send myself — and easily integrates with CloudWatch and Lambda.</p><h3>CI/CD overview</h3><p>This part was important to me, mainly because there were many moving parts to my scraper — and the AWS console can be tedious.</p><p>I used both <strong>CodePipeline</strong> and <strong>TravisCI</strong> for commit-triggered building/deployment. This was mainly for my own experimentation. I found that TravisCI is able to do everything I needed, so I will be moving my CodePipeline projects to TravisCI and save that extra $1 per month 😉</p><p>I used the <a href="https://www.serverless.com/"><strong>Serverless Framework</strong></a><strong> </strong>to handle Lambda deployments via TravisCI’s build-scripts.</p><p>The python scraper is containerized and deployed to Amazon’s <strong>ECR</strong>, where the image is referenced/launched as needed by AWS Batch.</p><p>I will admit, I took a hacky approach to my Cron Event-Rules: I wrote <strong>CloudFormation</strong> templates with the event payload embedded as JSON.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/34f5f9d943212afc135c6c5d4fa62b62/href">https://medium.com/media/34f5f9d943212afc135c6c5d4fa62b62/href</a></iframe><p>The escaped “jsonInput” is a little messy, but I am able to easily add or remove jobs via these templates. For example, if I wanted to add another scraping job, I would just add “group2a” with new “jsonInput” and “cronExpression” values.</p><p>I should note the “TemplateURL” routes to an event-rule CloudFormation template pointing to a single Lambda function which is configured to receive the “jsonInput” and dispatch jobs to AWS Batch accordingly.</p><p>When a change is needed, the templates are modified and committed to Github. As soon as the pull-request is merged to my master branch, TravisCI updates the CloudFormation stack with the latest changes. This process makes it extremely simple for me to scale-up or scale-down my Scalable-Scraper.</p><h3>Now for the Whole Shebang</h3><p>…and here is my whole solution — from CI/CD to text-alerts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qI3tB2kGzExew3i3JOtQLw.png" /><figcaption>Image by author</figcaption></figure><h3>Stay tuned!</h3><p>Do you want to find out how to get a terrific deal (you wouldn’t believe the price) on a beauty like this? Or possibly you are more interested in the project itself…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e5teXuSAF4yk89o3yY7cfg.jpeg" /><figcaption>1998 Mercedes SLK 230 (supercharged), 50k miles, hardtop convertible (everything works perfectly). Yes it’s mine. (<em>Image by author)</em></figcaption></figure><p>As mentioned above, I will be writing about the post-processing of my dataset soon. As a sneak-peek, I ran some analytics on a sample dataset from 2 months of California-Mercedes-Benz data (I have about 6 months of data now!). Guess what I found?</p><p>According to this (small) dataset, my SLK has the highest selling rate of all Mercedes-Benz listings on Craigslist!</p><p>Check it out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*3Sj13Fts-XGYRGzqqExNcA.png" /><figcaption>There’s the SLK with a ~38% selling rate. Graph created by author.</figcaption></figure><p>That’s some cool data, right?</p><p>I would love to hear your thoughts on this solution — there is more than one way to skin a cat. Leave comments below!</p><p>Let’s connect on <a href="https://www.linkedin.com/in/aaron-langley/">Linkedin</a>!</p><p>Cheers!</p><p>— Aaron Langley</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=654feb9fdad7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/get-your-own-data-building-a-scalable-web-scraper-with-aws-654feb9fdad7">Get Your Own Data — Building a Scalable Web-Scraper with AWS</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OfferUp vs Craigslist: comparing the GUI’s]]></title>
            <link>https://medium.com/@aarongjlangley/offerup-vs-craigslist-comparing-the-guis-cbc8775966ce?source=rss-d98a4b98a998------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbc8775966ce</guid>
            <category><![CDATA[online-shopping]]></category>
            <category><![CDATA[marketplaces]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[craigslist]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Aaron Langley]]></dc:creator>
            <pubDate>Sat, 02 Dec 2017 03:46:06 GMT</pubDate>
            <atom:updated>2017-12-10T23:02:58.181Z</atom:updated>
            <content:encoded><![CDATA[<p>In the past five months I have purchased a laptop, car, and dive gear second-hand. I found the laptop for a stellar deal on OfferUp, and the other two on Craigslist (great deals from both marketplaces). I am perfectly happy with my purchases, but I found myself frustrated during the search process. It was difficult to pinpoint the problem at first, then it dawned on me — the layout was hurting my eyes.</p><p>When were you last at an airport where you did not have to check, double-check — turn around and check again — the list of arrival and departure times on that screen. Personally, I think it’s a ruse, implemented by airlines, to ensure the sobriety of their passengers. And here’s another thought — I think OfferUp’s staggered-unreadable-grid-layout serves the same purpose —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*QJReymK-T6aI72xV0555ig.jpeg" /><figcaption>Pretty isn’t it? Very up-to-date with the modern eCommerce peer-2-peer marketplace technology</figcaption></figure><p>I could see how an inebriated individual might have trouble navigating this site. Thus, I’ll have to conclude that OfferUp’s design team <em>must </em>be trying to keep those who frequent the bottle off their site…</p><p>In all seriousness however, while OfferUp’s site is definitely up-to-date with their UI (user-interface) technology, it seems that they have stepped beyond the scope of their application. It is a wonderfully mobile-responsive site, but to call it user friendly would be a stretch.</p><p>I believe that on account of it’s modern UI (as well as the fact that it offers an app with integrated messaging), OfferUp tends to cater to the young — us. The millennials. OfferUp enables us to have the same “click” — “click” — “buy” process that has made Amazon’s app so successful. Granted, there is a little more effort that goes in to finalizing the OfferUp purchase — it doesn’t show up on your door two days later.</p><h4>“KISS” — Keep It Simple Stupid — the best advice out there</h4><p>I am getting sidetracked. My point in bringing the poor Millennial was to illustrate the upside to using an application such as OfferUp. It’s ease of use — snap a picture, upload, sell. Or, more properly: “buy, sell, simple.”</p><p>In this respect, then, it is clear that OfferUp has a “leg up” on Craigslist, i.e. simplicity in selling.</p><p>But my focus is on the Graphical User Interface (GUI) itself — as a shopper, OfferUp is all but simple. Let’s compare the sites:</p><p>the oldie-but-goodie:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*Gx45XTH17PhwyTouJ4svSA.png" /><figcaption>Look how ordered it is! And yes, I live in Orange County</figcaption></figure><p>Searching for cars:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D3QNjLH7myF4bxPxTwv05w.png" /><figcaption>Nice — but… a bit cluttered don’t you think?</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbjPmaxU0LNVzltp51QerA.png" /><figcaption>Not as pretty — but the important information is very readable</figcaption></figure><p>I should note that the view-mode is highly customizable as well on Craigslist’s site.</p><h3>“The truth is like a lion; you don’t have to defend it. Let it loose; it will defend itself.”</h3><p>Those screenshots should speak for themselves.</p><p>Before I get PETA on my case for beating a dead horse, I will wrap things up by warning online businesses to keep their scope in mind. Home Depot is a warehouse. It should be a warehouse. Anthropology is a store that sells pretty things, it is thus what? — A pretty store. Craigslist, OfferUp, Letgo, and other peer-to-peer marketplaces should keep in mind that since they are selling such a large range of products, their environment should be organized, simple, and user-friendly. If I wanted an enjoyable car-purchasing experience, I’ll go to a dealership — but no — I am cheap, I am looking for a deal, I want an online flea-market — full of great deals, beat-up cars, minus fleas, plus organization.</p><p>Good job Craig, you beat the contemporary marketplace with your simplistic design. Who would’ve guessed that with all the fancy web-design tools available today, simplistic CSS was the way to go?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbc8775966ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>