What is Data Scraping?

Unlock the secrets of automated data collection and understand how software extracts valuable information from websites efficiently.

Ceyhun Enki Aksan
Ceyhun Enki Aksan Entrepreneur, Maker

While reading a book or browsing the web, we navigate to resources in accordance with our intended purpose. Earlier mentioned Search Intent illustrated how search engine algorithms handle this process.

In this article, we’ll examine how, just as we look for headings, highlights, or captivating words in a book, or for headings, images, highlights, or sentences in different colors on a website, data is systematically retrieved through software in alignment with a specific objective. Yes, our topic is data scraping.

Data Scraping

Data is presented in various formats (text, visual, audio) and across different sources, accessible to humans and/or other systems for various purposes. This access may be open or restricted. While human readability is not a mandatory requirement during data capture and presentation, it will undoubtedly be a key criterion for content such as a blog post, social media feed, or a PDF article. Search engines, using their respective algorithms, scan, interpret, and categorize content in this manner. All of these processes are generally referred to as data scraping.

Data Scraping, in general terms, refers to the process of extracting structured data from a data source by a computer program. Of course, copying and pasting data from a web page and/or an Excel spreadsheet can also be considered data scraping. However, if we disregard simple operations, we must acknowledge that manually copying and pasting data from within a dataset is a highly tedious process. On the other hand, extracting data from images and audio files often still requires human intervention. Although various algorithms can now perform these tasks, they have not yet achieved the desired level of success. We previously discussed data scraping as a general term. Therefore, let us elaborate on this topic a bit further.

Screen Scraping

Screen scraping is related to the process of collecting text data programmatically from a computer terminal screen, rather than parsing data (which I will discuss in detail under a dedicated heading). The required data is obtained from the screen output of another program. These operations can also encompass more complex scenarios where data is processed through a user interface. In short, screen scraping can be described as a component of programming that acts as an intermediary between legacy applications and modern user interfaces. Instead of scanning databases or files, the scraping process occurs where data is displayed visually. Thus, operations are performed based on the data delivered to the user.

RPA tools such as Ui-Path1 and Jacada2 can be considered for this purpose.

Reporting mining refers to extracting data from a report. For example, a user interface that displays page views and session durations can include dynamic or frequently updated (daily, weekly, etc.) organic traffic data, ad clicks, sales, or credit card transactions. Specific fields within reports can be aggregated into a file and evaluated during a separate analysis process, and can be preserved as static reports. Reporting mining enables more efficient utilization of resources (such as CPU usage, license, and output costs), and facilitates easier error and alert management by allowing rapid access to relevant data within reports.

Reporting mining does not require interaction with dynamic outputs such as screen scraping or web scraping. Instead, it primarily involves extracting data from text-based files such as HTML, PDF, CSV, or Excel. This approach eliminates (or minimizes) the need for access to the source system, making it simple and fast.

Web Scraping

We will frequently focus on web scraping, which is defined as the process of scanning text-based markup languages (such as XHTML, HTML, Markdown), parsing data exchanged between web servers and/or applications (such as JSON, XML, YAML, etc.), and extracting data from these files. A wide range of tools and programming languages have been developed to support this purpose.

Web scraping can be applied in various contexts, such as price, news, and trend monitoring, competitive analysis, and contact information tracking. By scanning the content of a website, one can extract word frequency data, or by scanning personal information, profile building can be achieved.

Today, DOM parsing, computer vision, and NLP (Natural Language Processing)—techniques that mimic human behavior—can be used automatically to extract content. Of course, the ethical and/or legal implications of such operations are debated3 4 5. Even if data on price comparison, understanding, collecting communication information, and similar data are publicly available, they can still be used within certain defined boundaries. These boundaries are established by the countries where the data is obtained and used. For example, the EU’s framework, in the context of its citizens, has been defined by the General Data Protection Regulation (GDPR).

Websites with large or limited access often implement various security measures to prevent data scraping. Specific IP addresses or IP ranges being blocked, or encountering robot detection mechanisms, are common occurrences. On the other hand, unauthorized scanning and the discovery of sensitive information during such scans can lead to various legal issues.

Web Scraping
What is the difference between web scraping and crawling?

Web Scraping Process

A URL is required for web scraping operations. A request is sent to the URL, and the response received is then parsed to extract the desired data. Requesting and viewing are essentially fundamental behaviors of an internet browser. Therefore, web crawling can be considered the core component of a web scraping process. Various operations such as searching, filtering, parsing, reformatting, and copying can be performed within the response received from the server.

Web scraping can be used for a variety of purposes, including web monitoring, journalism, web indexing, data mining, price and product comparison, and more.

Web scraping can be performed using various techniques, based on programming languages and applications.

  • One approach involves JavaScript code that can be processed through developer tools and the console available in modern web browsers.
  • Operations can be performed via the Web Scraper6 Chrome extension and/or the Outwit Hub7 Firefox extension.
  • Alternative solutions such as ScraperWiki8 or Selenium9 can also be considered.
  • Libraries available in programming languages such as Python and R can be utilized.

Differences Between Web Scraping and Web Crawling

Web scraping and web crawling represent distinct processes. In simple terms, web crawling refers to the process of scanning websites performed by search engines such as Google, Yandex, Bing, and Yahoo, or by tools that mimic the behavior of these search engines (e.g., SEO tools like Ahrefs, Screaming Frog, DeepCrawl, etc.). This process is carried out through a “spider” (crawler) that operates on a web browser. These spiders can be programmed to perform specific behaviors (e.g., only images, only audio files, etc.). Starting from a source URL, the crawler discovers and retrieves all linked pages, traversing the domain structure and monitoring the status of each link. In essence, it builds an index of the website. The information retrieved about the pages is generally either random or contextually general. On the other hand, certain tools also pay attention to the complete loading of a URL and how it is rendered visually.

Web scraping can also include the crawling process. A target URL is scanned according to a specific purpose, and specified information (such as price, email, phone number, address, title, content, or a portion of the content) is extracted from the scanned page. This extraction can be performed using markers such as position, tag, class, or ID. On the other hand, crawling may not be required—scraping can be performed solely based on specified URLs. For this purpose, sitemap files, product XML files, and RSS feeds, among others, can be used.

Further Reading

*[RPA]: Robotic Process Automation

Footnotes

  1. How to: Scrape the Whole Text, Including Hidden Elements from a Terminal Window. Ui Path
  2. Jacada. Customer Service Automation - Call Center Software
  3. “Verileri Kazıma”, 13 EKİM 2023, Yavuz Akbulak
  4. “Bir Web Sayfasını İçerik İçin ‘Kazımak’ Yasal mı?”, Bilgi Güvende
  5. “Web Kazıma (Web Scraping) ve İnternet Sitelerine Yönelik Koruma”, Güleryüz Partners
  6. Web Scraper
  7. OutWit Hub
  8. Scraper Wiki
  9. Selenium automates browsers