Closed mohammad-fahs closed 2 months ago
The website chosen for this example is "Books to Scrape" (http://books.toscrape.com). It’s a demo site designed specifically for practicing web scraping techniques. The site features a collection of books organized into categories, with each book listing its title, price, rating, and other details. The layout is simple and static, making it ideal for learning and practicing scraping.
The data scraped includes:
The scraped data was extracted from the main page of the site, where each book is displayed in a grid format. The book titles and prices were retrieved using CSS selectors that target the specific HTML elements containing this information. Task2.zip @mohammad-fahs
Task 2 :
Objective:
In this task, you will initialize a new Spring Boot project, add the JSoup dependency, and write a simple Java program to scrape data from a website of your choice. The goal is to get hands-on experience with setting up a Spring Boot project, using an external library (JSoup), and applying web scraping techniques.
Instructions:
com.yourname
web-scraper
Web Scraper
com.yourname.webscraper
Spring Web
dependency (to allow adding more features later).pom.xml
file in the root directory of your project.<dependencies>
tag:pom.xml
file and allow IntelliJ to update the Maven project to download the JSoup library.com.yourname.webscraper
package that implements theCommandLineRunner
interface.run
method, use JSoup to connect to the website you chose and scrape the data.Submit Your Work:
CommandLineRunner
.Resources that can help: