svgastronomie

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 12 Imported by: 2

README

go-svgastronomie

license version go reference GitHub

A web scraper for extracting the weekly menu from sv-gastronomie.de.

Installation

go get github.com/EchterTimo/go-svgastronomie

Usage

Check out the examples directory for some usage examples.

Check out the following project that uses this library:

Repo Card

The website sv-gastronomie.de does not provide an official public API.

As of August 2026, automated access is explicitly permitted via their robots.txt:

User-agent: *
Disallow: 

Use this scraper responsibly and at your own risk.

This project is not affiliated with or endorsed by sv-group.

Documentation

Overview

Package svgastronomie provides functions to fetch the weekly menu of a SV restaurant from sv-gastronomie.de

Index

Constants

View Source
const (
	BaseURL         string = "https://sv-gastronomie.de"
	MenuURL         string = BaseURL + "/menu"
	MenuTemplateURL string = BaseURL + "/menu/%s/%s" // %s is the restaurant URL
)

Below are constants used in the svgastronomie package.

Variables

This section is empty.

Functions

func DefaultCacheDirectories added in v0.2.0

func DefaultCacheDirectories() ([]string, error)

DefaultCacheDirectories returns the default cache directories for Playwright.

  • Windows: %USERPROFILE%\AppData\Local
  • macOS: ~/Library/Caches
  • Linux: ~/.cache

func EnsureInstalled added in v0.2.0

func EnsureInstalled()

EnsureInstalled attempts to install Playwright or panics if installation fails.

func EnsureInstalledAndClearTerminal added in v0.2.1

func EnsureInstalledAndClearTerminal()

EnsureInstalledAndClearTerminal attempts to install Playwright and clears the terminal screen.

func Install

func Install() error

Install installs Playwright by downloading the necessary browser binaries.

func IsInstalled added in v0.2.0

func IsInstalled() bool

IsInstalled checks if Playwright is usable by attempting to start and stop it.

func Uninstall added in v0.2.0

func Uninstall() error

Uninstall deletes the playwright cache dir which equals to uninstalling playwright.

func ValidateURL added in v0.2.2

func ValidateURL(rawURL string) error

ValidateURL checks if the given URL is valid for scraping.

Types

type Day

type Day struct {
	Time   time.Time `json:"time"` // Time is the current date in the format YYYY-MM-DD 00:00:00 UTC.
	Dishes []Dish    `json:"dishes"`
}

Day represents the menu for a specific day.

type Dish

type Dish struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Price       float64  `json:"price"`
	Tags        []string `json:"tags"`
}

Dish represents a single dish available on a specific day.

type Restaurant

type Restaurant struct {
	URL      string `json:"url"`
	Location string `json:"location"`
	MenuCard string `json:"menu_card"`
	Week     Week   `json:"week"`
}

Restaurant represents a restaurant available on sv-gastronomie.de.

func ScrapeRestaurant

func ScrapeRestaurant(
	url string,
	handleNewDay func(day Day),
) (*Restaurant, error)

ScrapeRestaurant scrapes the restaurant's page and returns a Restaurant object.

Playwright needs to be installed for this function to work.

Use sv.EnsureInstalled() or sv.Install() dependind on your needs before calling this function.

The handleNewDay is an optional callback function that can be used to handle new days as they are scraped.

Browser automation flow is sequential and clearer as one function.

type Week

type Week struct {
	Days []Day `json:"days"`
}

Week represents the menu for a specific week.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL