upadted to 1.24.0; fixed stb and spiddped doubles in precene

This commit is contained in:
2025-03-03 09:28:41 +02:00
parent 0ecf0ddec1
commit 203f834f65
41 changed files with 1058 additions and 219 deletions

View File

@@ -2,7 +2,6 @@ package parser
import (
"errors"
"fmt"
"io"
"log"
"log/slog"
@@ -15,7 +14,7 @@ import (
func setClient(url string) (*http.Response, error) {
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
log.Fatalln(err)
}
@@ -27,9 +26,12 @@ func setClient(url string) (*http.Response, error) {
func HTMLSourceFromURL(url string) (*html.Node, error) {
resp, err := setClient(url)
defer func(Body io.ReadCloser) {
fmt.Printf("%v\n", Body == nil)
if resp == nil {
slog.Error("client return nil response", "err", err)
return nil, err
}
defer func(Body io.ReadCloser) {
err = Body.Close()
if err != nil {
slog.Error("closing response body", "err", err)