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

36
pkg/handler/stb.go Normal file
View File

@@ -0,0 +1,36 @@
package handler
import (
"errors"
"fmt"
"log/slog"
"github.com/spf13/viper"
"git.amok.space/yevhen/resource-scraper/types/constant"
)
func (h *Handler) STB() string {
endpoint := fmt.Sprintf("%s.%s", constant.ScopeShareTheBrutality, constant.CfgKeyEndpoint)
endpoint = viper.GetString(endpoint)
if endpoint == "" {
slog.Error("getting endpoint from config", "err", errors.New("no endpoint provided"))
return "stb"
}
es, ms := h.services.ShareTheBrutality.GetMail(endpoint)
//fmt.Printf("%+v\n", es)
ms.LogOut()
for _, record := range es {
fmt.Printf("%s %d: %s [#%s]\n", record.Created, record.Id, record.Title, record.Releaser)
}
/*if err != nil {
slog.Error("error occurred while getting topic: ", "err", err)
}*/
return fmt.Sprintf("Added %d records\n", len(es))
}