cahnge git server and fixed time parsing

This commit is contained in:
2025-10-06 12:21:22 +03:00
parent 970f6c2bfd
commit 1544b943fc
11 changed files with 108 additions and 52 deletions

View File

@@ -10,8 +10,8 @@ import (
"strings"
"time"
"github.com/dromara/carbon/v2"
"github.com/go-shiori/dom"
"github.com/golang-module/carbon/v2"
"github.com/jmoiron/sqlx"
"github.com/spf13/viper"
@@ -114,7 +114,7 @@ func parseUrl(endpoint string, db *sqlx.DB) ([]model.ExternalSources, error) {
localtime := dom.QuerySelector(title, "small > span.localtime")
if localtime != nil {
lc := dom.GetAttribute(localtime, "data-lttime")
es.Created = carbon.Parse(lc)
es.Created = carbon.Parse(lc, "Europe/Kyiv")
}
}

View File

@@ -9,7 +9,7 @@ import (
"net/url"
"strconv"
"github.com/golang-module/carbon/v2"
"github.com/dromara/carbon/v2"
"github.com/jmoiron/sqlx"
"github.com/spf13/viper"
@@ -48,8 +48,7 @@ func (s *Rutracker) GetTopic(topics []string) ([]model.ExternalSources, error) {
es.Title = e.Title
es.TypeSubsectionId, _ = strconv.Atoi(t)
es.Releaser = e.Author.Name
es.Created = carbon.Parse(e.Updated)
es.Created = carbon.Parse(e.Updated, "Europe/Kyiv")
esModel := table.ExternalSources{Columns: columns}
entry := esModel.InsertOnDuplicate(es, s.db)
entries = append(entries, entry)

View File

@@ -7,19 +7,19 @@ import (
"strconv"
"strings"
"github.com/dromara/carbon/v2"
"github.com/emersion/go-imap/v2"
"github.com/go-shiori/dom"
"github.com/golang-module/carbon/v2"
"github.com/jmoiron/sqlx"
"github.com/spf13/viper"
"golang.org/x/net/html"
"git.amok.space/yevhen/resource-scraper/helper/parser"
"git.amok.space/yevhen/resource-scraper/helper/sugar"
"git.amok.space/yevhen/resource-scraper/internal/mail"
_table "git.amok.space/yevhen/resource-scraper/pkg/repository/table"
"git.amok.space/yevhen/resource-scraper/types/constant"
"git.amok.space/yevhen/resource-scraper/types/model"
"git.kplus.net.ua/yevhen/resource-scraper/helper/parser"
"git.kplus.net.ua/yevhen/resource-scraper/helper/sugar"
"git.kplus.net.ua/yevhen/resource-scraper/internal/mail"
_table "git.kplus.net.ua/yevhen/resource-scraper/pkg/repository/table"
"git.kplus.net.ua/yevhen/resource-scraper/types/constant"
"git.kplus.net.ua/yevhen/resource-scraper/types/model"
)
type ShareTheBrutality struct {
@@ -47,7 +47,10 @@ func (s *ShareTheBrutality) GetMail(email string) ([]model.ExternalSources, *mai
//now := carbon.Now()
s.EmailService.ListMessages(viper.GetStringSlice(mailboxes), searchCriteria)
//box.CreateMailbox("INBOX/Processed")
//s.EmailService.CreateMailbox("Processed")
//s.EmailService.CreateMailbox("Succeed")
//s.EmailService.CreateMailbox("Processed/Succeed")
//s.EmailService.DeleteMailbox("Processed")
//s.EmailService.CreateMailbox("Processed/Failed")
//s.EmailService.CreateMailbox("Processed/Suspicious")
//s.EmailService.MailboxesList()
@@ -131,7 +134,8 @@ func (s *ShareTheBrutality) Processing(sender map[string]string) []model.Externa
}
es.Releaser = sourceDataMatch[1]
es.Created = carbon.Parse(msg.Envelope.Date.String())
es.Created = carbon.Parse(msg.Envelope.Date.String(), "Europe/Kyiv")
es.Type = dbType
genre := strings.ToLower(sourceDataMatch[2])