<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TeraCrawler</title>
    <description>The latest articles on DEV Community by TeraCrawler (@crawlertera).</description>
    <link>https://dev.to/crawlertera</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F443066%2F706890f5-e70a-4626-b068-dea141c2d58b.png</url>
      <title>DEV Community: TeraCrawler</title>
      <link>https://dev.to/crawlertera</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crawlertera"/>
    <language>en</language>
    <item>
      <title>Create Web Crawlers That Don't Die on You
</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Mon, 02 Nov 2020 17:24:25 +0000</pubDate>
      <link>https://dev.to/crawlertera/create-web-crawlers-that-don-t-die-on-you-4aeo</link>
      <guid>https://dev.to/crawlertera/create-web-crawlers-that-don-t-die-on-you-4aeo</guid>
      <description>&lt;p&gt;Here are some rules of thumb to follow when building web crawlers that can scale.&lt;/p&gt;

&lt;p&gt;De-couple the web crawling and the web scraping process. This is because you can then measure and speed up the performance of each of these processes separately.&lt;br&gt;
Do not use Regex for scraping. Use XPath or CSS selectors instead. Regex will be the first to break when the target web page's HTML changes even a little bit.&lt;br&gt;
Assume every external dependant process or method will fail and write handlers and loggers for each. For example, assume the URL fetch will fail, timeout, redirect, return empty, or show a CAPTCHA. Anticipate and log each of these exceptions.&lt;br&gt;
Make it easy to debug your app by tracing all the steps your crawler goes through. Make the logger as rich as possible. Send yourself alerts so you immediately know if there is something wrong.&lt;br&gt;
Learn how to get your crawlers to pretend to be human.&lt;br&gt;
Build a crawler around a framework. Custom code will have a bunch more points of failure.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Do you make these 9 mistakes while web crawling?</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Mon, 02 Nov 2020 17:23:16 +0000</pubDate>
      <link>https://dev.to/crawlertera/do-you-make-these-9-mistakes-while-web-crawling-5b4e</link>
      <guid>https://dev.to/crawlertera/do-you-make-these-9-mistakes-while-web-crawling-5b4e</guid>
      <description>&lt;p&gt;Here is a bunch of things that can get you in trouble while web crawling:&lt;/p&gt;

&lt;p&gt;Not respecting Robots.txt.&lt;br&gt;
Not using Asynchronous connections to speed up crawling.&lt;br&gt;
Not use CSS selectors or XPath to reliably scrape data.&lt;br&gt;
Not use a user-agent string.&lt;br&gt;
Not rotate user-agent strings.&lt;br&gt;
Not add a random delay between requests to the same domain.&lt;br&gt;
Not use a framework.&lt;br&gt;
Not monitor the progress of your crawlers.&lt;br&gt;
Not use a rotating proxy service like Proxies API.&lt;br&gt;
Being smart about web crawling is realizing that it's not about the code. In our experience at Teracrawler developing cloud-based web crawlers at scale, most of the web crawling and web scraping is about controlling these variables. Having a systematic approach to web crawling and getting to a place where you can get frequent and reliable data and scale day in and day out can change the fortunes of your company.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fix Your Web Scrapers with This 15 Point Checklist
</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Tue, 27 Oct 2020 13:09:46 +0000</pubDate>
      <link>https://dev.to/crawlertera/fix-your-web-scrapers-with-this-15-point-checklist-2jgo</link>
      <guid>https://dev.to/crawlertera/fix-your-web-scrapers-with-this-15-point-checklist-2jgo</guid>
      <description>&lt;p&gt;Web scrapers are known to die on us. It's because so much is dependant on things on the internet we cant control. We at Proxies API always say if you want to understand the internet build a web crawler.web scraping tools, web scraping, web scraping api, best web scraping tools, web scraping tools open source&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Lead Generation Through Web Scraping</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Wed, 21 Oct 2020 10:30:33 +0000</pubDate>
      <link>https://dev.to/crawlertera/lead-generation-through-web-scraping-1i7m</link>
      <guid>https://dev.to/crawlertera/lead-generation-through-web-scraping-1i7m</guid>
      <description>&lt;p&gt;Web scraping is one of the best ways to generate leads for your business quite easily.&lt;/p&gt;

&lt;p&gt;Today we will look at a practical example of how to get leads from online business directories.&lt;/p&gt;

&lt;p&gt;Here are 57 of them that you can scrape leads from&lt;/p&gt;

&lt;p&gt;That's a lot. So in this article lets learn how to scrape one of them, Yellow pages so that you can use the same techniques to scrape data from the others. Here we are imagining a scenario where we are looking to generate a list of Dentists that we can target.&lt;/p&gt;

&lt;p&gt;BeautifulSoup will help us extract information, and we will retrieve crucial pieces of information from Yellow Pages.&lt;/p&gt;

&lt;p&gt;To start with, this is the boilerplate code we need to get the Yellowpages.com search results page and set up BeautifulSoup to help us use CSS selectors to query the page for meaningful data.&lt;/p&gt;

&lt;p&gt;We are also passing the user agent headers to simulate a browser call, so we don't get blocked.&lt;/p&gt;

&lt;p&gt;Now let's analyse the Yellow pages search results. This is how it looks.&lt;/p&gt;

&lt;p&gt;And when we inspect the page, we find that each of the items HTML is encapsulated in a tag with the class v-card&lt;/p&gt;

&lt;p&gt;We could just use this to break the HTML document into these cards which contain individual item information like this.&lt;/p&gt;

&lt;p&gt;And when you run it.&lt;/p&gt;

&lt;p&gt;You can tell that the code is isolating the v-cards HTML&lt;/p&gt;

&lt;p&gt;On further inspection, you can see that the name of the place always has the class business-name. So let's try and retrieve that.&lt;/p&gt;

&lt;p&gt;That will get us the names.&lt;/p&gt;

&lt;p&gt;Bingo!&lt;/p&gt;

&lt;p&gt;Now let's get the other data pieces.&lt;/p&gt;

&lt;p&gt;And when run.&lt;/p&gt;

&lt;p&gt;Produces all the info we need including ratings, reviews, phone, address etc&lt;/p&gt;

&lt;p&gt;If you want to use this in production and want to scale to thousands of links, then you will find that you will get IP blocked easily by Yellow Pages. In this scenario, using a rotating proxy service to rotate IPs is almost a must. You can use a service like Proxies API to route your calls through a pool of millions of residential proxies.&lt;/p&gt;

&lt;p&gt;If you want to scale the crawling speed and don't want to set up you own infrastructure, you can use our Cloud base crawler crawltohell.com to easily crawl thousands of URLs at high speed from our network of crawlers.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Answer to Last Week's Web Scraping Challenge
</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Sat, 17 Oct 2020 04:57:29 +0000</pubDate>
      <link>https://dev.to/crawlertera/answer-to-last-week-s-web-scraping-challenge-7d2</link>
      <guid>https://dev.to/crawlertera/answer-to-last-week-s-web-scraping-challenge-7d2</guid>
      <description>&lt;p&gt;We at TeraCrawler.io do a lot of web crawling and web scraping. We write a lot about it too here as well as on our blog. Every day is a new challenge. When a new developer joins our team, we throw a few challenges at them to test their ability to think through a quagmire that is web scraping.&lt;/p&gt;

&lt;p&gt;So last week we posted a web scraping coding challenge to see if some of you wanted to test yourself against a real-world web scraping problem. Here is our answer to that problem in a step by step manner:&lt;/p&gt;

&lt;p&gt;So in the challenge we had to scrape Flipkart data using Python and BeautifulSoup is a simple and elegant manner.&lt;/p&gt;

&lt;p&gt;So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.&lt;/p&gt;

&lt;p&gt;Then you can install beautiful soup with:&lt;/p&gt;

&lt;p&gt;We will also need the libraries requests, lxml, and soupsieve to fetch data, break it down to XML, and to use CSS selectors. Install them using...&lt;/p&gt;

&lt;p&gt;Once installed open an editor and type in:&lt;/p&gt;

&lt;p&gt;Now let's go to the Flipkart listing page and inspect the data we can get.&lt;/p&gt;

&lt;p&gt;This is how it looks:&lt;/p&gt;

&lt;p&gt;Back to our code now. Let's try and get this data by pretending we are a browser like this:&lt;/p&gt;

&lt;p&gt;Save this as scrapeFlipkart.py.&lt;/p&gt;

&lt;p&gt;If you run it:&lt;/p&gt;

&lt;p&gt;You will see the whole HTML page.&lt;/p&gt;

&lt;p&gt;Now, let's use CSS selectors to get to the data we want. To do that let's go back to Chrome and open the inspect tool.&lt;/p&gt;

&lt;p&gt;We notice that all the individual product data are contained in a with the attribute data-id. You also notice that the attribute value is some gibberish and it's always changing. We cant use this. But the clue is the presence of the data-id attribute itself. That's all we need. So let's extract that.&lt;/p&gt;

&lt;p&gt;This prints all the content in each of the containers that hold the product data.&lt;/p&gt;

&lt;p&gt;The second line above gives us the URL to the listing.&lt;/p&gt;

&lt;p&gt;The product rating has a meaningful id productRating followed by some gibberish. But we can use the *= operator to select anything which has the word productRating. &lt;/p&gt;

&lt;p&gt;Scraping the price is even more challenging because it has no discernable class name or ID as a clue to get to it. But it always has the currency denominator ₹ in it. So we use regex to find it.&lt;/p&gt;

&lt;p&gt;We do the same to get the discount percentage. It always has the word off in it.&lt;/p&gt;

&lt;p&gt;Putting it all together.&lt;/p&gt;

&lt;p&gt;If you run it it will print out all the details.&lt;/p&gt;

&lt;p&gt;Bingo!! We got them all. That was challenging and satisfying.&lt;/p&gt;

&lt;p&gt;If you want to use this in production and want to scale to thousands of links then you will find that you will get IP blocked easily by Flipkart. In this scenario using a rotating proxy service to rotate IPs is almost a must. You can use a service like Proxies API to route your calls through a pool of millions of residential proxies.&lt;/p&gt;

&lt;p&gt;If you want to scale the crawling speed and dont want to set up your own infrastructure, you can use our Cloud base crawler teracrawler.io to easily crawl thousands of URLs at high speed from our network of crawlers.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>New to web scraping? Here is a challenge for you
</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Wed, 14 Oct 2020 17:36:21 +0000</pubDate>
      <link>https://dev.to/crawlertera/new-to-web-scraping-here-is-a-challenge-for-you-3f3j</link>
      <guid>https://dev.to/crawlertera/new-to-web-scraping-here-is-a-challenge-for-you-3f3j</guid>
      <description>&lt;p&gt;We at TeraCrawler.io do a lot of web crawling and web scraping. We write a lot about it too here as well as on our blog. Every day is a new challenge. When a new developer joins our team, we throw a few challenges at them to test their ability to think through a quagmire that is web scraping.&lt;/p&gt;

&lt;p&gt;We thought we will expose one such challenge here so you can have fun with it. This will help you rack your brains, force you to research, and think outside the box and in the end you will find you now know 5 new things about scraping than you knew before. Please post your answers as comments to see all the various ways you can approach this problem. Don't worry, we will post our answer in a week's time as a follow-up post.&lt;/p&gt;

&lt;p&gt;The scenario:&lt;/p&gt;

&lt;p&gt;Suppose you are a phone retailer who wants to keep tabs on all the prices of phones on Flipkart, the eCommerce website in India (there is a reason we picked Flipkart and not a global website like Amazon as you will see) and their prices, ratings and especially, the percentage discounts they are offering.&lt;/p&gt;

&lt;p&gt;What you have to do:&lt;/p&gt;

&lt;p&gt;You will have to crawl product data from Flipkart.com for the product category phones and extract the following details:&lt;/p&gt;

&lt;p&gt;Title of the product, URL, Rating, Price, and discount percentage.&lt;/p&gt;

&lt;p&gt;What's challenging about this:&lt;/p&gt;

&lt;p&gt;As you will discover, Flipkart happens to have no obvious way to point at the data we want. Generally, websites like Amazon are easily scrapable because of the way the HTML and the CSS classes are meaningfully laid out. You can use CSS selectors to point at data and simply scrape them. None of that will fly with Flipkart because as shown below, the CSS classed are all auto-generated gibberish. Also, from having scraped with the website before, we know you will need to jump through different hoops for different pieces of data on this website. So have at it:&lt;/p&gt;

&lt;p&gt;What you will learn&lt;/p&gt;

&lt;p&gt;You will learn how to use creative ways to reliably point at data you want. A sort of web scraping parkour if you will. You will fail, fail, fail and then you will learn.&lt;/p&gt;

&lt;p&gt;Tools you can use&lt;/p&gt;

&lt;p&gt;Ideally, you can use Python and Beautiful soup to do the scraping. We are not strict about the language or the library as long as it gets the job done, but our answers a week from now will using Python and Beautiful Soup.&lt;/p&gt;

&lt;p&gt;Enjoy the hunt. See you a week later :-)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Scraping Cars.com Product Details with Python and Beautiful Soup</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Fri, 09 Oct 2020 05:43:26 +0000</pubDate>
      <link>https://dev.to/crawlertera/scraping-cars-com-product-details-with-python-and-beautiful-soup-3oel</link>
      <guid>https://dev.to/crawlertera/scraping-cars-com-product-details-with-python-and-beautiful-soup-3oel</guid>
      <description>&lt;p&gt;Today we are going to see how we can scrape Cars.com product details using Python and BeautifulSoup in a simple and elegant manner.&lt;/p&gt;

&lt;p&gt;The aim of this article is to get you started on a real-world problem solving while keeping it super simple so you get familiar and get practical results as fast as possible.&lt;/p&gt;

&lt;p&gt;So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.&lt;/p&gt;

&lt;p&gt;Then you can install beautiful soup with:&lt;/p&gt;

&lt;p&gt;We will also need the libraries requests, lxml, and soupsieve to fetch data, break it down to XML, and to use CSS selectors. Install them using:&lt;/p&gt;

&lt;p&gt;Once installed open an editor and type in:&lt;/p&gt;

&lt;p&gt;Now let's go to the Cars.com product details listing page and inspect the data we can get.&lt;/p&gt;

&lt;p&gt;This is how it looks:&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Scraping Corona Virus data with Python and Beautiful Soup</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Sun, 04 Oct 2020 16:40:02 +0000</pubDate>
      <link>https://dev.to/crawlertera/scraping-corona-virus-data-with-python-and-beautiful-soup-526a</link>
      <guid>https://dev.to/crawlertera/scraping-corona-virus-data-with-python-and-beautiful-soup-526a</guid>
      <description>&lt;p&gt;Today we are going to see how we can scrape Corona Virus data using Python and BeautifulSoup in a simple manner.&lt;/p&gt;

&lt;p&gt;The aim of this article is to get you started on a real-world problem solving while keeping it super simple so you get familiar and get practical results as fast as possible.&lt;/p&gt;

&lt;p&gt;So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.&lt;/p&gt;

&lt;p&gt;Then you can install beautiful soup with:&lt;/p&gt;

&lt;p&gt;We will also need the libraries requests, lxml, and soupsieve to fetch data, break it down to XML, and to use CSS selectors. Install them using:&lt;/p&gt;

&lt;p&gt;Once installed open an editor and type in:&lt;/p&gt;

&lt;p&gt;Now let's go to the Corona Virus data listing page at the ECDC website and inspect the data we can get.&lt;/p&gt;

&lt;p&gt;This is how it looks:&lt;/p&gt;

&lt;p&gt;Back to our code now. Let's try and get this data by pretending we are a browser like this:&lt;/p&gt;

&lt;p&gt;If you run it.&lt;/p&gt;

&lt;p&gt;You will see the whole HTML page&lt;/p&gt;

&lt;p&gt;Now, let's use CSS selectors to get to the data we want. To do that let's go back to Chrome and open the inspect tool.&lt;/p&gt;

&lt;p&gt;We notice that all the individual product data are contained in a with rows containing individual country info and the tags containing the specific fields of data.&lt;/p&gt;

&lt;p&gt;So we can extract them like this:&lt;/p&gt;

&lt;p&gt;If we run it we will get all the data we need.&lt;/p&gt;

&lt;p&gt;We got them all.&lt;/p&gt;

&lt;p&gt;If you want to use this in production and want to scale to thousands of links then you will find that you will get IP blocked easily by several websites. In this scenario using a rotating proxy service to rotate IPs is almost a must. You can use a service like Proxies API to route your calls through a pool of millions of residential proxies.&lt;/p&gt;

&lt;p&gt;If you want to scale the crawling speed and don't want to set up your own infrastructure, you can use our Cloud base crawler crawltohell.com to easily crawl thousands of URLs at high speed from our network of crawlers.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Systematic Web Scraping
</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Wed, 30 Sep 2020 17:22:18 +0000</pubDate>
      <link>https://dev.to/crawlertera/systematic-web-scraping-2ko4</link>
      <guid>https://dev.to/crawlertera/systematic-web-scraping-2ko4</guid>
      <description>&lt;p&gt;If it helps to think of a web crawler as a system than a piece of code.&lt;/p&gt;

&lt;p&gt;This shift is very important and will be forced on any developer whoever attempts web scraping at scale.&lt;/p&gt;

&lt;p&gt;It is one of the best ways to learn thinking in systems.&lt;/p&gt;

&lt;p&gt;We can see the whole crawling process as a workflow with multiple possible points of failure. in fact, any place where the scraper is dependant on external resources is a place it could and will fail. So 90% of the time spent by the developer is in fixing in bit and pieces these inevitable issues.&lt;/p&gt;

&lt;p&gt;At Proxies API, we have gone through the drudgery of not thinking in a systematic way about web scraping till we one day took a step back and identified the central problem. The code was never the problem. The whole thing didn't work as a system. We finally decided on our own set of rules to make crawlers that work systematically.&lt;/p&gt;

&lt;p&gt;Here are the rules that the system has to obey:&lt;/p&gt;

&lt;p&gt;Handle fetching issues (timeouts, redirects, headers, browser spoofing, CAPTCHAs and IP blocks)&lt;br&gt;
Where the crawler doesn't have a solution to each of the issues(for example, CAPTCHAs), it should at least handle and log them.&lt;br&gt;
The system should be able to "step over" any issue and not stumble and fail to bring everything down with it.&lt;br&gt;
The system should immediately alert the developer about an issue.&lt;br&gt;
The system should help the developer diagnose the last issue quickly with as much context as possible, so it is easily re-producable&lt;br&gt;
The system should be as generic as possible at the code level and should push individual website logic to an external database as much as possible.&lt;br&gt;
The system should have enough levers to control the speed and scale of the crawl.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Wake Up. Your Web Crawler is Down</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Sat, 26 Sep 2020 16:17:49 +0000</pubDate>
      <link>https://dev.to/crawlertera/wake-up-your-web-crawler-is-down-10jg</link>
      <guid>https://dev.to/crawlertera/wake-up-your-web-crawler-is-down-10jg</guid>
      <description>&lt;p&gt;If you have ever written a web crawler, you will find that it is one of the most bafflingly difficult programs to write. And as a beginner, it's almost a guarantee that we will make several mistakes in the process of building one.&lt;/p&gt;

&lt;p&gt;Initially, we think building a crawler is about building the code. The code works on an example website. It's able to crawl, scrape, and store data. What could go wrong?&lt;/p&gt;

&lt;p&gt;Well, it turns out its many things.&lt;/p&gt;

&lt;p&gt;I remember when I wrote my first crawler. It was in PHP. It would use CURL requests to download pages, then scrape them using Regex, paginate and store the data in MySQL.&lt;/p&gt;

&lt;p&gt;And once we deployed it, this became the theme of my life.&lt;/p&gt;

&lt;p&gt;Wake up. The Web Crawler is down&lt;br&gt;
And it was always something new.&lt;/p&gt;

&lt;p&gt;The way I had coded it if the code broke while crawling a page, the whole process broke down. The rest of the crawl would stop, and so would the scraping. I also had no way of knowing how many URLs I had finished crawling and whether they were successfully fetched and also if they were successfully scraped. I had no way to resume where I left off. I had not heard of Robots.txt. I don't know they I could use Asynchronous requests to download URLs concurrently. I had no rules that I had set about not following external links. Once I did manage to write the code for it, it would not fetch the CDN images because it was slightly different. My code was so complex, and I was at my wit's end. So I would hard code many things particular to a website into the code. There was a separate project for each website I had to scrape.&lt;/p&gt;

&lt;p&gt;I didn't know that there were frameworks where most of the heavy lifting was already done that I could use. The code was working fine in my little setup. But out there in the wild, it failed at the drop of a hat.&lt;/p&gt;

&lt;p&gt;The website was unreachable - My crawler would break.&lt;/p&gt;

&lt;p&gt;The website changed the HTML patterns. My Regex would break.&lt;/p&gt;

&lt;p&gt;The website threw out a CAPTCHA challenge - my crawler would have a meltdown.&lt;/p&gt;

&lt;p&gt;Websites would simply block me all the time, and I would restart my router to get a new IP and connect every time.&lt;/p&gt;

&lt;p&gt;Writing a web crawler is one of the most fun jobs in programming but also one of the most difficult.&lt;/p&gt;

&lt;p&gt;Eventually, al these frustrations lead to a lot of learning, and we developed tools like Proxies API and crawltohell to help people overcome as many of these problems as simply and as easily as possible.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Web Crawling an Entire Blog</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Tue, 22 Sep 2020 09:09:03 +0000</pubDate>
      <link>https://dev.to/crawlertera/web-crawling-an-entire-blog-43b2</link>
      <guid>https://dev.to/crawlertera/web-crawling-an-entire-blog-43b2</guid>
      <description>&lt;p&gt;One of the most common applications of web crawling, according to the patterns we see with many of our customers at crawltohell is scraping blog posts. Today lets look at how we can build a simple scraper to pull out and save blog posts from a blog like CopyBlogger.&lt;br&gt;
There are about ten posts on this page. We will try and scrape them all.&lt;/p&gt;

&lt;p&gt;First, we need to install scrapy if you haven't already.&lt;br&gt;
Once installed, we will add a simple file with some barebones code.&lt;br&gt;
Let's examine this code before we proceed.&lt;/p&gt;

&lt;p&gt;The allowed_domains array restricts all further crawling to the domain paths specified here.&lt;/p&gt;

&lt;p&gt;start_urls is the list of URLs to crawl for us; in this example, we only need one URL.&lt;/p&gt;

&lt;p&gt;The LOG_LEVEL settings make the scrapy output less verbose, so it is not confusing.&lt;/p&gt;

&lt;p&gt;The def parse(self, response): function is called by scrapy after every successful URL crawl. Here is where we can write our code to extract the data we want.&lt;/p&gt;

&lt;p&gt;Now let's see what we can write in the parse function.&lt;br&gt;
When we inspect this in the Google Chrome inspect tool (right-click on the page in Chrome and click Inspect to bring it up), we can see that the article headlines are always inside an H2 tag with the CSS class entry-title. This is good enough for us. We can just select this using the CSS selector function.&lt;br&gt;
This will give us the Headline. We also need the href in the 'a' which has the class entry-title-link, so we need to extract this as well.&lt;br&gt;
So lets put this all together.&lt;br&gt;
Let's save it as BlogCrawler.py and then run it with these parameters, which tells scrapy to disobey Robots.txt and also to simulate a web browser.&lt;br&gt;
When you run, it should return.&lt;br&gt;
Those are all the blog posts. Let's save them into files.&lt;br&gt;
When you run it now, it will save all the blog posts into a file folder.&lt;/p&gt;

&lt;p&gt;But if you look at it, there are more than 320 odd pages like this on CopyBlogger. We need a way to paginate through to them and fetch them all.&lt;br&gt;
When we inspect this in the Google Chrome inspect tool, we can see that the link is inside an LI element with the CSS class pagination-next. This is good enough for us. We can just select this using the CSS selector function.&lt;br&gt;
This will give us the text 'Next Page,' though. What we need is the href in the 'a' tag inside the LI tag. So we modify it to this.&lt;br&gt;
The moment we have the URL, we can ask Scrapy to fetch the URL contents.&lt;br&gt;
And when you run it, it should download all the blog posts that were ever written on CopyBlogger onto your system.&lt;br&gt;
Scaling Scrapy&lt;/p&gt;

&lt;p&gt;The example above is ok for small scale web crawling projects. But if you try to scrape large quantities of data at high speeds, you will find that sooner or later, your access will be restricted. Web servers can tell you are a bot, so one of the things you can do is run the crawler impersonating a web browser. This is done by passing the user agent string to the Wikipedia web server, so it doesn't block you.&lt;br&gt;
In more advanced implementations, you will need to even rotate this string, so Copyblogger can't tell it the same browser! Welcome to web scraping.&lt;/p&gt;

&lt;p&gt;If you want to use this in production and want to scale to thousands of links, then you will find that you will get IP blocked easily by Copyblogger. In this scenario, using a rotating proxy service to rotate IPs is almost a must. You can use a service like Proxies API to route your calls through a pool of millions of residential proxies.&lt;/p&gt;

&lt;p&gt;If you want to scale the crawling speed and don't want to set up your infrastructure, you can use our Cloud base crawler crawltohell.com to easily crawl thousands of URLs at high speed from our network of crawlers.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Web Scraping Don'ts</title>
      <dc:creator>TeraCrawler</dc:creator>
      <pubDate>Fri, 18 Sep 2020 10:25:04 +0000</pubDate>
      <link>https://dev.to/crawlertera/web-scraping-don-ts-40gc</link>
      <guid>https://dev.to/crawlertera/web-scraping-don-ts-40gc</guid>
      <description>&lt;p&gt;Web scraping projects are known to fail a lot. So we thought it is more appropriate to have a list of DON'Ts rather than a list of DO's. So here goes.&lt;/p&gt;

&lt;p&gt;If the crawler depends on any external data or event to happen in a particular way, Don't assume it will happen like that. It won't MORE often than it does. For example: when fetching a URL, it could break because of timeouts, redirects, CAPTCHA challenges, IP blocks, etc.&lt;br&gt;
DON'T build custom code. Use a framework like scrapy.&lt;br&gt;
DON'T be too aggressive on a website. Check the response time of the website first. In fact, at crawltohell.com, our crawlers adjust their concurrency depending on the response time of the domain, so we don't burden their servers too much.&lt;br&gt;
DON'T write linear code. Don't write code that crawls, scrapes data, processes it, and stores it all in one linear process. If one breaks, so will the others, and also, you would be able to measure and optimize the performance of each process. Batch them instead.&lt;br&gt;
DON'T depends on your IP's. They will eventually get blocked. Always build in the ability to proxy your requests through a Rotating Proxy Service like Proxies API.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
