Compare commits

...

4 Commits

Author SHA1 Message Date
c6d1a8d455 fixed mails moving 2025-10-28 13:36:53 +02:00
c8745e1f60 some mirror fixed 2025-10-28 12:59:54 +02:00
ac4b0ef47b added to ignore STONERD in prescene 2025-10-28 11:38:00 +02:00
879b33d385 all fixed 2025-10-28 11:36:11 +02:00
9 changed files with 27 additions and 18 deletions

View File

@@ -2,7 +2,5 @@ scope:
allow: [info, web, rutracker, prescene, stb, metal-archives, console]
default: console
mail:
amok.space:
dial-tls: mail.amok.space:993
kplus.net.ua:
dial-tls: s21.thehost.com.ua:993

View File

@@ -73,6 +73,6 @@ groups:
- HiTE
- RPO
- MEOWZiK
# - STONERD
- STONERD
- TR
- W4GN3R

View File

@@ -1,16 +1,16 @@
role: console
stb:
endpoint: stb@amok.space
#mailboxes: ["INBOX"]
endpoint: stb@kplus.net.ua
mailboxes: ["INBOX"]
#mailboxes: ["INBOX", "Junk Mail", "Done"]
mailboxes: ["Junk Mail"]
#mailboxes: ["Junk Mail"]
#mailboxes: ["Done"]
search-criteria: ["Your Share The Brutality digest", "noreply@sharethebrutality.info"]
move-processed-to-mailbox:
succeed: Processed/Succeed
succeed: Succeed
#succeed: Done
failed: Processed/Failed
suspicious: Processed/Suspicious
failed: Failed
suspicious: Suspicious
sender:
mailbox: noreply
host: sharethebrutality.info

2
install.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
env GOBIN=/usr/local/bin go install ./cmd

View File

@@ -24,7 +24,7 @@ Commands:
-section -s Select section e.g.: rutracker, bandcamp etc.
The Go runtime version: %s
Report bugs to https://git.amok.space/yevhen/resource-scraper/issues`
Report bugs to https://git.kplus.net.ua/yevhen/resource-scraper/issues`
const (
version = "0.1"

View File

@@ -68,8 +68,12 @@ func (s *EmailService) Login() {
err := s.client.Login(s.User, s.pass).Wait()
if s.CheckErr("Login", err) {
fmt.Println("========================================")
fmt.Println(err.Error())
fmt.Println("========================================")
return
}
s.success(s.User + " logged")
}
@@ -117,6 +121,7 @@ func (s *EmailService) ListMessages(mailboxes []string, criteria *imap.SearchCri
}
messages, err := s.client.Fetch(seqSet, fetchOptions).Collect()
if s.CheckErr("Fetch", err) {
continue
}
@@ -176,7 +181,9 @@ func (s *EmailService) MoveMessageToMailbox(msg *client.FetchMessageBuffer, stat
movable.AddNum(msg.SeqNum)
mailbox := viper.GetStringMapString("stb.move-processed-to-mailbox")
wait, err := s.client.Move(movable, mailbox[status]).Wait()
if s.CheckErr("Moving to archive", err) {
fmt.Println("Error moving to mail:", mailbox[status], "Error:", err.Error())
return false
}

View File

@@ -44,7 +44,7 @@ func (s *Prescene) GetPage(pageNumbers []string) ([]model.ExternalSources, error
endpoint += fmt.Sprintf(viper.GetString(constant.CfgKeyEndpointNext), t)
}
//doc, err := parser.HTMLSourceFromURL("https://mdb.amok.space/$/scnlog.html")
//doc, err := parser.HTMLSourceFromURL("https://mdb.kplus.net.ua /$/scnlog.html")
if result, err := parseUrl(endpoint, s.db); err == nil {
entries = append(entries, result...)
} else {

View File

@@ -47,13 +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()
//s.EmailService.DeleteMailbox("Succeed")
s.EmailService.MailboxesList()
entries := s.Processing(viper.GetStringMapString(fmt.Sprintf("%s.sender", s.scope)))
@@ -144,7 +141,7 @@ func (s *ShareTheBrutality) Processing(sender map[string]string) []model.Externa
entries = append(entries, es)
}
fmt.Println(entries)
//fmt.Println(entries)
//os.Exit(0)
result, status := _table.BatchInsertOnDuplicate(entries, s.db, columns)

View File

@@ -67,6 +67,11 @@ func BatchInsertOnDuplicate(entries []model.ExternalSources, db *sqlx.DB, column
}
func (f *ExternalSources) GetTypeIds(entries []model.ExternalSources, db *sqlx.DB) []int {
if len(entries) == 0 {
fmt.Printf("Entries are empty")
return nil // або логування помилки
}
var typeIds []int
ids := thither.FieldValueToStrSlice(entries, "TypeId")
query := fmt.Sprintf("SELECT type_id FROM %s WHERE `type` = '%s' AND type_id IN (%s) LIMIT %d", constant.ExternalSourcesTable, entries[0].Type, strings.Join(ids, ","), len(ids))