1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Harvest only JSON files.

This commit is contained in:
Sascha L. Teichmann 2022-05-17 11:51:29 +02:00
parent 4428679822
commit eaa2620eba
2 changed files with 11 additions and 5 deletions

View file

@ -12,6 +12,7 @@ import (
"io"
"net/http"
"net/url"
"strings"
"github.com/PuerkitoBio/goquery"
)
@ -66,6 +67,10 @@ func linksOnPage(r io.Reader, resolve func(string) (string, error)) ([]string, e
return
}
if link, ok := s.Attr("href"); ok {
// Only care for JSON files here.
if !strings.HasSuffix(link, ".json") {
return
}
if link, err = resolve(link); err == nil {
links = append(links, link)
}