Digitala Vetenskapliga Arkivet

Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Prestandaanalys av ett lättviktigt webbskrapningsverktyg i Java: En jämförelse med Selenium, Jsoup och HtmlUnit för statisk dataextraktion
University of Gävle, Faculty of Engineering and Sustainable Development, Department of Computer and Geospatial Sciences, Computer Science.
2025 (Swedish)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesis
Abstract [sv]

Webbskrapning är en teknik för att automatiskt extrahera information från webbsidor och används idag inom flera olika områden. De etablerade biblioteken som används för att utföra webbskrapning är ofta överdimensionerade för enkla behov. Det finns idag begränsad empirisk forskning om hur lättviktiga och specialanpassade verktyg för webbskrapning presterar jämfört med etablerade bibliotek.

Syftet med denna studie var att undersöka om webbskrapning kan göras mer effektiv genom att ersätta etablerade bibliotek med ett specialutvecklat och lättviktigt verktyg i Java, byggt helt utan externa beroenden. Som ett delmål jämfördes även de etablerade biblioteken sinsemellan. Hypotesen var att det egenutvecklade, lättviktiga verktyget skulle prestera bättre på samtliga mätpunkter. Arbetet avgränsades till att endast hantera statiskt webbinnehåll.

För att besvara forskningsfrågorna utvecklades fem olika verktyg. Två var egenutvecklade, lättviktiga verktyg, där det ena bygger på reguljära uttryck och det andra på en enkel, egenutvecklad DOM-parser. Tre verktyg var baserade på de etablerade Java-biblioteken Selenium, Jsoup och HtmlUnit. En experimentell, kvantitativ metod användes för att mäta prestanda i form av exekveringstid, processoranvändning och minnesanvändning. Samtliga verktyg genomförde samma tester på tre olika offentliga webbsidor.

Resultaten visade att det egenutvecklade verktyget baserat på reguljära uttryck hade bäst prestanda på alla punkter, även om skillnaden mot Jsoup inte var stor. Jsoup presterade bäst bland de etablerade biblioteken och var både snabbare och använde mindre CPU än verktyget baserat på den egenutvecklade DOM-parsern. Selenium och HtmlUnit hade betydligt sämre prestanda, framför allt Selenium, som använde mest resurser och hade avsevärt längre exekveringstid än resterade verktyg.

Slutsatsen var att ett lättviktigt, specialutvecklat verktyg kan vara mer effektivt än etablerade bibliotek vid statisk webbskrapning, men att valet av skrapningsmetod har större betydelse för prestandan än om verktyget är lättviktigt eller ej.

Abstract [en]

Web scraping is a technique for automatically extracting information from web pages and is used today in multiple different areas. The established libraries used for web scraping are often overengineered for simple needs. Currently, there is limited empirical research on how lightweight and custom developed tools for web scraping performs compared to established libraries.

The aim of this study was to investigate whether web scraping can be made more efficient by replacing established libraries with a custom developed and lightweight tool in Java, built completely without external dependencies. As a secondary objective, the established libraries were also compared with each other. The hypothesis was that the custom developed, lightweight tool would perform better in all measured aspects. The study was limited to handling only static web content.

To answer the research questions, five different tools were developed. Two were custom developed, lightweight tools, one based on regular expressions and the other on a simple, custom developed DOM parser. Three tools were based on the established Java libraries Selenium, Jsoup, and HtmlUnit. An experimental, quantitative method was used to measure performance in terms of execution time, processor usage, and memory usage. All tools performed the same tests on three different public websites.

The results showed that the custom developed tool based on regular expressions had the best performance in all aspects, although the difference compared to Jsoup was not large. Jsoup performed the best among the established libraries and was both faster and used less CPU than the tool based on the custom developed DOM parser. Selenium and HtmlUnit had significantly worse performance, especially Selenium, which used most resources and had a considerably longer execution time than the other tools.

The conclusion was that a lightweight, custom developed tool can be more efficient than established libraries when scraping static content, but that the choice of scraping method has a greater impact on performance than whether the tool is lightweight or not.

Place, publisher, year, edition, pages
2025. , p. 40
Keywords [en]
Web scraping, Performance comparison, Java, Lightweight tool
Keywords [sv]
Webbskrapning, Prestandajämförelse, Java, Lättviktigt verktyg
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:hig:diva-48087OAI: oai:DiVA.org:hig-48087DiVA, id: diva2:1990435
Subject / course
Computer science
Supervisors
Examiners
Available from: 2025-08-20 Created: 2025-08-20 Last updated: 2025-10-02Bibliographically approved

Open Access in DiVA

Prestandaanalys av ett lättviktigt webbskrapningsverktyg i Java(1225 kB)69 downloads
File information
File name FULLTEXT01.pdfFile size 1225 kBChecksum SHA-512
bd8ecf4d0f6c1127d82fc2eb85827bc4f2ca024e26d219349bffe93aa29f039f2318abfbc8c8ced8277d0d5d1d15b85ab61414480a1a8878987cc77b8ea286cc
Type fulltextMimetype application/pdf

By organisation
Computer Science
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 71 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 61 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf