Fix goquery code

This commit is contained in:
Jeffrey Serio 2024-03-30 07:58:02 -05:00
parent 049e3ec49b
commit 394739d135

View File

@ -18,7 +18,7 @@ type Kali struct {
func (k Kali) AddNewTorrents(transmissionbt *transmissionrpc.Client) error { func (k Kali) AddNewTorrents(transmissionbt *transmissionrpc.Client) error {
// Send HTTP GET request and receive response // Send HTTP GET request and receive response
k.URL = fmt.Sprintf("https://cdimage.kali.org/kali-%s/", k.Relver) k.URL = fmt.Sprintf("https://cdimage.kali.org/kali-%s", k.Relver)
respBody, err := common.GetResponse(k.URL) respBody, err := common.GetResponse(k.URL)
if err != nil { if err != nil {
return err return err
@ -34,7 +34,7 @@ func (k Kali) AddNewTorrents(transmissionbt *transmissionrpc.Client) error {
var torrentURLs []string var torrentURLs []string
doc.Find("a").Each(func(i int, s *goquery.Selection) { doc.Find("a").Each(func(i int, s *goquery.Selection) {
if strings.Contains(s.Text(), ".torrent") { if strings.Contains(s.Text(), ".torrent") {
torrentURLs = append(torrentURLs, fmt.Sprintf("%s/kali-linux-%s-%s.torrent", k.URL, k.Relver, s.Text())) torrentURLs = append(torrentURLs, fmt.Sprintf("%s/%s", k.URL, s.Text()))
} }
}) })