What is web scraping and what is it for?

December 03, 2019
Did you like our post?
5/5 - (3 votes)
5/5 - (3 votes)

Have you ever wondered what web scraping is?. It is a process that uses bots to extract content and data from a website. That way, the HTML code is extracted along with the stored data in the database. This means that all website content can be duplicated or copied elsewhere.

Web scraping is used in many digital enterprises that are dedicated to the compilation of databases. To understand web scraping, you should know about its legal uses:

  • Search engine robots track a site, analyze its content and then rank it.
  • Price comparison sites that use bots to automatically obtain prices and product descriptions for partner sellers.
  • Market research companies use it to extract data from forums and social networks.

To learn more about web scraping you should know that it is also used for illegal purposes. Including price scraping and theft of copyrighted content. The affected digital entity may suffer serious financial losses, most notably if it is a business that is based primarily on competitive pricing models or offers in content distribution.

Do you really know what web scraping is?

A Web scraping tool is a software that uses scripted bots to analyze databases and extract information. Many types of bots are used, many of them fully customizable to:

  • Recognize structures of exclusive HTML sites.
  • Extract and transform content.
  • Store data.
  • Extract data from APIs.

Since all bots use the same system to access site data, it can be difficult to distinguish between legitimate bots and malicious bots.

Key differences between legitimate and malicious bots

There are some key differences that will help you distinguish between the two:

  • Legitimate bots identify themselves to the organization for which they work. For example, Googlebot is identified in its HTTP header as belonging to Google. Malicious robots impersonate legitimate traffic by creating a fake HTTP user.
  • Legitimate bots comply with the robot.txt file of a site, which lists the sites that a robot can access and those that are restricted. The malicious ones, on the other hand, track the website regardless of what the site operator allows.

Legitimate bot operators invest in servers to process lots of extracted data. An attacker, who lacks such a budget, often makes use of a botnet. These are geographically scattered computers, infected with the same malware and controlled from a central location.

The owners of individual computers are unaware of their participation. The combined power of infected systems allows large-scale scraping of many different websites by the author.

Examples of web scraping

Web scraping is considered malicious when data is extracted without permission from the owners. The two most common use cases are price scraping and content theft.

1.- Price scraping

Price scraping is one type of web scraping. It is an attacker who generally uses a network of bots to launch web scraping bots to analyze the competitor’s databases. The objective is to obtain the price information, win against the rivals and boost sales. For attackers, a successful price scrape can make their offers stand out on comparison websites.

Attacks occur in industries where prices are easily comparable. Prices have an important role in purchasing decisions. Travel agencies and online electronics vendors are examples of the victims of price scraping.

For example, electronic smartphone retailers, who sell similar products at relatively similar prices, are frequent targets. To stay competitive, they have to sell their products at the best possible price.

Customers always opt for the cheapest offer. To gain an advantage, a supplier can use a bot to continuously scrape the websites of its competitors and update their own prices almost instantly.

2.- Content scraping

The scraping of content is another way that allows us to understand web scraping. It is the theft of large-scale content from a given site. Usual objectives include online product catalogs and websites that rely on digital content to promote the company. For these companies, a content scraping attack can be devastating.

For example, online business catalogs invest significant amounts of time, money and energy in building their database. It is used for sending spam campaigns. Or resell it to competitors. It is likely that any of these events affect the results of a company and its daily operations.

Protection against web scraping

1.- Act legally

The easiest way to avoid scraping is to take legal action. One in which you can legally denounce the attack and prove that web scraping is not allowed.

You can even sue potential scrapers if you have explicitly prohibited it in your terms of service. For example, LinkedIn sued a group of scrapers last year, stating that extracting user data through automated requests is equivalent to piracy.

2.- Prevent attacks from incoming requests

Even if you have a legal notice that prohibits scraping your services, a potential attacker may still want to execute the process. You can identify possible IP addresses and prevent requests from reaching your service by filtering through the firewall.

Although it is a manual process, modern cloud service providers give you access to tools that block possible attacks. For example, if you are hosting your services on Amazon web services, the AWS Shield would protect your server from possible attacks.

3.- Use Cross-Site Request Forgery (CSRF)

By using CSRF tokens in your app, you will prevent automated tools from making arbitrary requests to URLs. A CSRF token can be present as a hidden form field.

To get around a CSRF token, it is necessary to load, analyze and search for the correct token, before grouping it with the request. This process requires programming skills and professional tools.

4.- Use the .htaccess file to avoid scratching

.htaccess is a configuration file for your web server. It can be modified to prevent scrapers from accessing your data. The first step is to identify the scrapers, which can be done through Google Webmasters.

Once you’ve identified them, you can use many techniques to stop the scraping process by changing the configuration file. Usually, this file is not enabled so you must enable it, this allows the files you place in your directory to be interpreted.

5.- Prevent hotlinking

When your content is scraped, online links to images and other files are copied directly to the attacker’s site. When the same content is displayed on the attacker’s site, that resource is linked directly to your website.

The process of displaying a resource that is hosted on the server on a different website is called hotlinking. When you avoid an active link, an image of this type, when displayed on a different site, is not made through your server.

6.- Specific IP addresses: blacklists

If you have identified the IP addresses or patterns of IP addresses that are used for scraping, you can simply block them through your .htaccess.

7.- Limit the number of requests for an IP address

Alternatively, you can also limit the number of requests for an IP address. Although it may not be useful if an attacker has access to several IP addresses. A captcha can also be used in case of abnormal requests from an IP address.

You have to block access from the known IP addresses of the cloud hosting and tracking service to ensure that an attacker cannot use that service to delete or copy your data.

8.- Create “honeypots”

A “honeypot” is a link to fake content that is invisible to a normal user but exists in the HTML. It would appear when a program analyzes the website. By redirecting a scraper to these honeypots, you can detect scrapers and make them waste resources when visiting pages that do not contain data.

Therefore, do not forget to disable those links in your robots.txt file to ensure that a search engine does not end up in such honeypots.

9.- Change the HTML structure frequently

Most scrapers analyze the HTML that is obtained from the server. To impede access to the data, you can frequently change the structure of the HTML. By doing so, an attacker must reassess the structure of your website to extract the data.

10.- Provide APIs

You can allow selective extraction of data from your site if you set certain rules. One way is to create subscription-based APIs to monitor and give access to your data. Through the APIs, you can also monitor and restrict the use of the service you offer.

If you do not want to struggle with web scraping or hassles of any kind, you should always rely on platforms that provide security. And that also offers you the services you need for each marketing campaign. Antevenio can help you in that matter. Trust our easy and effective Branded & Content Marketing services.


Do you want us to help you boost your sales through digital marketing?