HTML Scraper
A Spring Boot pipeline that fetches a page, parses it with Jsoup, maps the data to POJOs and writes an Excel file.
A Spring Boot application for scraping HTML data and converting it into an Excel spreadsheet.
The pipeline runs end to end: it fetches raw HTML from a given URL, extracts the relevant information, maps it to structured Java objects (POJOs), and writes the results into an .xls Excel file.
Tech stack
- Spring Boot, the main application framework
- Jsoup, for HTML parsing
- Apache POI, for Excel file generation
- Spring Configuration, for setup through
application.properties
How it works
- Fetch the HTML content. Makes a
GETrequest to the target URL and retrieves the HTML response. - Parse the HTML with Jsoup. Uses Jsoup to create a
Documentobject and navigate the DOM. - Map to POJO objects. Extracted data is converted into Java classes for easy manipulation.
- Export to Excel (XLS). Generates a formatted
.xlsspreadsheet using Apache POI. - Configure through the properties file. Keywords and target URL can be defined in
application.properties.
How to run
- Clone the repository:
git clone https://github.com/maltsev-dev/html_scraper_template
cd html_scraper_template
- Configure the app in
src/main/resources/application.properties:
target.url=https://example.com
scraper.keywords=Item,Price,Details
- Run the application:
./mvnw spring-boot:run
- The output Excel file (
output.xls) will be generated in the project root.
What it is good for
- Fully based on the Java ecosystem
- Requires no browser automation or WebDriver
- Easily customizable for different scraping needs
- Simple to set up and extend
License
This project is licensed under the MIT License.
Neighbors in time
when name
Related: the posts that share this one's subject, and where the thread goes next.