add scraping the torrent topics rss files

This commit is contained in:
2024-09-09 08:54:29 +03:00
parent 20c4f25c55
commit e587e645fc
26 changed files with 714 additions and 22 deletions

14
types/constants.go Normal file
View File

@@ -0,0 +1,14 @@
package types
const (
RuTracker string = "rutracker"
)
const (
RoleConsole string = "console"
)
const (
DateTimeFormat string = "2006-01-02 15:04:05"
ExternalSourcesTable string = "external_sources"
)

5
types/interfaces.go Normal file
View File

@@ -0,0 +1,5 @@
package types
type Rutracker interface {
GetTopic(topics []string) error
}

35
types/rutracker.go Normal file
View File

@@ -0,0 +1,35 @@
package types
import "encoding/xml"
type RutrackerAtomTopic struct {
XMLName xml.Name `xml:"feed"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
ID string `xml:"id"`
Link struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
} `xml:"link"`
Updated string `xml:"updated"`
Title string `xml:"title"`
Entry []struct {
Text string `xml:",chardata"`
ID string `xml:"id"`
Link struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
} `xml:"link"`
Updated string `xml:"updated"`
Title string `xml:"title"`
Author struct {
Text string `xml:",chardata"`
Name string `xml:"name"`
} `xml:"author"`
Category struct {
Text string `xml:",chardata"`
Term string `xml:"term,attr"`
Label string `xml:"label,attr"`
} `xml:"category"`
} `xml:"entry"`
}

View File

@@ -0,0 +1,39 @@
package table
import "time"
type Type string
/*const (
mmt Type = iota
prescene
rutracker
locate
darkabyss
bfm
trash
nnmc
stb
bandcamp
deathgrind
)*/
type ExternalSources struct {
Id int `json:"id" db:"id"`
Type string `json:"type" db:"type"`
TypeId int `json:"type_id" db:"type_id"`
Title string `json:"title" db:"title"`
TypeSubsectionId int `json:"type_subsection_id" db:"type_subsection_id"`
Releaser string `json:"releaser" db:"releaser"`
ExSource string `json:"ex_source" db:"eXsource"`
Created time.Time `json:"created_at" db:"created"`
Modified time.Time `json:"modified_at" db:"modified"`
Contents string `json:"contents" db:"contents"`
A string `json:"a" db:"a"`
H string `json:"h" db:"h"`
Fingerprint string `json:"fingerprint" db:"fingerprint"`
FsFingerprint string `json:"fs_fingerprint" db:"fs_fingerprint"`
Vid int `json:"vid" db:"vid"`
G string `json:"g" db:"g"`
ExternalSourcesCol string `json:"external_sources_column" db:"external_sourcescol"`
}