Skip to content
Surf Wiki
Save to docs
general/web-scraping

From Surf Wiki (app.surf) — the open knowledge base

Web scraping

Method of extracting data from websites


Method of extracting data from websites

Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites. Web scraping software may directly access the World Wide Web using the Hypertext Transfer Protocol or a web browser. While web scraping can be done manually by a software user, the term typically refers to automated processes implemented using a bot or web crawler. It is a form of copying in which specific data is gathered and copied from the web, typically into a central local database or spreadsheet, for later retrieval or analysis.

Scraping a web page involves fetching it and then extracting data from it. Fetching is the downloading of a page (which a browser does when a user views a page). Therefore, web crawling is a main component of web scraping, to fetch pages for later processing. Having fetched, extraction can take place. The content of a page may be parsed, searched and reformatted, and its data copied into a spreadsheet or loaded into a database. Web scrapers typically take something out of a page, to make use of it for another purpose somewhere else. An example would be finding and copying names and telephone numbers, companies and their URLs, or e-mail addresses to a list (contact scraping). Another example is collecting competitors’ product prices for marketing purposes.

Contact scraping is a type of web scraping that is used as a component of applications used for web indexing, web mining and data mining, online price change monitoring and price comparison, product review scraping (to watch the competition), gathering real estate listings, weather data monitoring, website change detection, research, tracking online presence and reputation, web mashup, and web data integration.

Web pages are built using text-based markup languages (HTML and XHTML), and frequently contain a wealth of useful data in text form. However, most web pages are designed for human end-users and not for ease of automated use. As a result, specialized tools and software have been developed to facilitate the scraping of web pages. Web scraping applications include market research, price comparison, content monitoring and artificial intelligence. Businesses rely on web scraping services to efficiently gather and utilize this data.

Newer forms of web scraping involve monitoring data feeds from web servers. For example, JSON is commonly used as a transport mechanism between the client and the web server.

There are methods that some websites use to prevent web scraping, such as detecting and disallowing bots from crawling (viewing) their pages. In response, web scraping systems use techniques involving DOM parsing, computer vision and natural language processing to simulate human-like browsing to enable gathering web page content for offline parsing.

History

After the birth of the World Wide Web in 1989, the first web robot, World Wide Web Wanderer, was created in June 1993, which was intended only to measure the size of the web.

In December 1993, the first crawler-based web search engine, JumpStation, was launched. As there were fewer websites available on the web, search engines at that time used to rely on human administrators to collect and format links. In comparison, Jump Station was the first WWW search engine to rely on a web robot.

In 2000, the first Web API and API crawler were created. In 2000, Salesforce and eBay launched their own API, with which programmers could access and download some of the data available to the public. Since then, many websites offer web APIs for people to access their public database.

Techniques

Data extraction techniques range from manual collection to sophisticated automated systems. Advanced methods analyze the underlying structure of web pages to transform unstructured content into a machine-readable format. These techniques utilize text processing or artificial intelligence, aligning with the technical goals of the Semantic Web.

Human copy-and-paste

The simplest form of web scraping is manually copying and pasting data from a web page into a text file or spreadsheet. Sometimes even the best web-scraping technology cannot replace a human's manual examination and copy-and-paste, and sometimes this may be the only workable solution when the websites for scraping explicitly set up barriers to prevent machine automation.

Text pattern matching

A simple yet capable approach to extract information from web pages is to use the UNIX grep command or regular expression-matching facilities of programming languages (for instance Perl or Python), in order to find text matching a specified pattern.

HTTP programming

Static and dynamic web pages can be retrieved by posting HTTP requests to the remote web server using socket programming.

HTML parsing

Many websites have large collections of pages generated dynamically from an underlying structured source like a database. Data of the same category are typically encoded into similar pages by a common script or template. In data mining, a program that detects such templates in a particular information source, extracts its content, and translates it into a relational form, is called a wrapper. Wrapper generation algorithms assume that input pages of a wrapper induction system conform to a common template and that they can be easily identified in terms of a URL common scheme. Moreover, some semi-structured data query languages, such as XQuery and the HTQL, can be used to parse HTML pages and to retrieve and transform page content.

DOM parsing

By using a program such as Selenium or Playwright, developers can control a web browser such as Chrome or Firefox wherein they can load, navigate, and retrieve data from websites. This method can be especially useful for scraping data from dynamic sites since a web browser will fully load each page. Once an entire page is loaded, you can access and parse the DOM using an expression language such as XPath.

Vertical aggregation

There are several companies that have developed vertical specific harvesting platforms. These platforms create and monitor a multitude of "bots" for specific verticals with no "man in the loop" (no direct human involvement), and no work related to a specific target site. The preparation involves establishing the knowledge base for the entire vertical and then the platform creates the bots automatically. The platform's robustness is measured by the quality of the information it retrieves (usually number of fields) and its scalability (how quick it can scale up to hundreds or thousands of sites). This scalability is mostly used to target the Long Tail of sites that common aggregators find complicated or too labor-intensive to harvest content from.

Semantic annotation recognizing

The pages being scraped may embrace metadata or semantic markups and annotations, which can be used to locate specific data snippets. If the annotations are embedded in the pages, as Microformat does, this technique can be viewed as a special case of DOM parsing. In another case, the annotations, organized into a semantic layer, are stored and managed separately from the web pages, so the scrapers can retrieve data schema and instructions from this layer before scraping the pages.

Computer vision web-page analysis

There are efforts using machine learning and computer vision that attempt to identify and extract information from web pages by interpreting pages visually as a human being might.{{cite web |url=http://www.xconomy.com/san-francisco/2012/07/25/diffbot-is-using-computer-vision-to-reinvent-the-semantic-web/

Methods to prevent web scraping

The administrator of a website can use various measures to stop or slow a bot. Some techniques include:

  • Blocking an IP address either manually or based on criteria such as geolocation and DNSRBL. This will also block all browsing from that address.
  • Disabling any web service API that the website's system might expose.
  • Bots sometimes declare who they are (using user agent strings) and can be blocked on that basis using robots.txt; 'googlebot' is an example. Other bots make no distinction between themselves and a human using a browser.
  • Bots can be blocked by monitoring excess traffic.
  • Bots can sometimes be blocked with tools to verify that it is a real person accessing the site, like a CAPTCHA. Bots are sometimes coded to explicitly break specific CAPTCHA patterns or may employ third-party services that utilize human labor to read and respond in real-time to CAPTCHA challenges. They can be triggered because the bot is: 1) making too many requests in a short time, 2) using low-quality proxies, or 3) not covering the web scraper’s fingerprint properly.
  • Commercial anti-bot services: Companies offer anti-bot and anti-scraping services for websites. A few web application firewalls have limited bot detection capabilities as well. However, many such solutions are not very effective.
  • Locating bots with a honeypot or other method to identify the IP addresses of automated crawlers.
  • Obfuscation using CSS sprites to display such data as telephone numbers or email addresses, at the cost of accessibility to screen reader users.
  • Because bots rely on consistency in the front-end code of a target website, adding small variations to the HTML/CSS surrounding important data and navigation elements would require more human involvement in the initial set up of a bot and if done effectively may render the target website too difficult to scrape due to the diminished ability to automate the scraping process.
  • Websites can declare if crawling is allowed or not in the robots.txt file and allow partial access, limit the crawl rate, specify the optimal time to crawl and more.
  • Trapping bots in a tarpit, feeding them nonsensical data to poison their dataset. This method is particularly effective against bots which ignore robots.txt files.
  • TLS Fingerprinting: Modern security systems analyze the Transport Layer Security (TLS) handshake to identify the client application. Different clients (e.g., Google Chrome vs. a Python script) send cryptographic ciphers and extensions in unique orders. This creates a unique "fingerprint" (such as a JA3 signature) that allows servers to detect and block automated scripts regardless of their IP address.

References

References

  1. (2021-07-28). "SASSCAL WebSAPI: A Web Scraping Application Programming Interface to Support Access to SASSCAL's Weather Data". Data Science Journal.
  2. "Search Engine History.com".
  3. (3 September 1995). "eBay, API's, and the Connected Web".
  4. Song, Ruihua. (Sep 14, 2007). "Proceedings of the 13th ACM SIGKDD international conference on Knowledge discovery and data mining".
  5. [http://www.gooseeker.com/en/node/knowledgebase/freeformat Semantic annotation based web scraping]
  6. Kenneth, Hirschey, Jeffrey. (2014-01-01). "Symbiotic Relationships: Pragmatic Acceptance of Data Scraping". Berkeley Technology Law Journal.
  7. (2007-08-20). "Ticketmaster Corp. v. Tickets.com, Inc.".
  8. (2003-06-13). "American Airlines, FareChase Settle Suit.". The Free Library.
  9. Imperva (2011). [http://www.imperva.com/docs/WP_Detecting_and_Blocking_Site_Scraping_Attacks.pdf Detecting and Blocking Site Scraping Attacks]. Imperva white paper.
  10. (2014-11-24). "CVENT, Inc. v. Eventbrite, Inc.,et al".
  11. "QVC Inc. v. Resultly LLC, No. 14-06714 (E.D. Pa. filed Nov. 24, 2014)".
  12. (5 December 2014). "QVC Sues Shopping App for Web Scraping That Allegedly Triggered Site Outage". Proskauer Rose LLP.
  13. (2010-09-17). "Did Iqbal/Twombly Raise the Bar for Browsewrap Claims?".
  14. (2009-06-10). "Can Scraping Non-Infringing Content Become Copyright Infringement... Because Of How Scrapers Work? {{!}} Techdirt".
  15. (July 2011). "Facebook v. Power Ventures".
  16. Chung, Andrew. (June 14, 2021). "U.S. Supreme Court revives LinkedIn bid to shield personal data". [[Reuters]].
  17. (18 April 2022). "Web scraping is legal, US appeals court reaffirms".
  18. (2006-02-24). "UDSKRIFT AF SØ- & HANDELSRETTENS DOMBOG". bvhd.dk.
  19. (2025-09-16). "AI Act {{!}} Shaping Europe's digital future".
  20. "La réutilisation des données publiquement accessibles en ligne à des fins de démarchage commercial {{!}} CNIL".
  21. FindDataLab.com. (2020-06-09). "Can You Still Perform Web Scraping With The New CNIL Guidelines?".
  22. National Office for the Information Economy. (February 2004). "Spam Act 2003: An overview for business". Australian Communications Authority.
  23. National Office for the Information Economy. (February 2004). "Spam Act 2003: A practical guide for business". Australian Communications Authority.
  24. (2023-08-31). "Web Scraping for Beginners: A Guide 2024".
  25. Mayank Dhiman [https://s3.us-west-2.amazonaws.com/research-papers-mynk/Breaking-Fraud-And-Bot-Detection-Solutions.pdf Breaking Fraud & Bot Detection Solutions] ''OWASP AppSec Cali' 2018'' Retrieved February 10, 2018.
  26. (2022-03-06). "What is web scraping?". DataDome.
  27. (28 January 2025). "AI haters build tarpits to trap and trick AI scrapers that ignore robots.txt". Ars Technica.
  28. "JA3 - A method for profiling SSL/TLS Clients". Salesforce Engineering.
  29. Ermakovich, Sergey. "What Is Web Scraping?".
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Web scraping — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report