Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Generate screenshots.json for
package main
import (
const URL = ""
//go:generate sh -c "go run generate-screenshots.go > screenshots.json"
func main() {
c := colly.NewCollector(colly.MaxDepth(1))
var screenshots []string
c.OnHTML("a[href]", func(e *colly.HTMLElement) {
link := e.Attr("href")
a := e.Request.AbsoluteURL(link)
if strings.HasSuffix(a, "Jurassic%20Park/") {
if strings.HasSuffix(a, ".jpg") || strings.HasSuffix(a, ".png") {
screenshots = append(screenshots, a)
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.