A simple web scraper written in Go using the Colly framework.
This scraper extracts recipe information (title, ingredients, prep time, cooking time, servings, etc.) from recipe web pages like Love and Lemons.
- Scrapes recipe name, ingredients, and basic specifications
- Uses CSS selectors to extract data
- Handles HTTP requests and errors gracefully
- Easily customizable to scrape other recipe sites by updating selectors
- Go 1.18+ installed on your machine
- Internet connection for scraping live websites
-
Clone this repository:
git clone https://github.com/loid-lab/go-webscrapper.git cd go-webscrapperr
-
Download dependencies:
go mod tidy
Run the scraper by providing the recipe URL as a command-line argument:
go run main.go scraper.go <recipe-url>
Example:
go run main.go scraper.go https://www.loveandlemons.com/homemade-pizza/
The program will visit the URL, scrape the recipe details, and print the results in the console.
main.go
: Entry point; parses command-line arguments and calls the scraper functionscraper.go
: Contains the scraping logic using Colly and data models for recipes
To scrape other websites or extract additional data:
- Inspect the target site's HTML structure
- Update CSS selectors inside
scraper.go
accordingly (in theScrapeRecipe
function)
MIT License © 2025 Loid
For questions or improvements, feel free to open an issue or contact me.