-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.go
72 lines (60 loc) · 3.16 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package configuration
// This file lists the fields that can be used in the configuration file of the soures
type Config struct {
SpecificScraper bool `json:"specificScraper"`
SpecificInfo map[string]string `json:"specificInfo"`
Search Search `json:"search"`
Login Login `json:"login"`
Name string `json:"name"`
Categories []string `json:"categories"`
CompatibleDownloaders []string `json:"compatibleDownloaders"`
Xxx bool `json:"xxx"`
}
// ----------------------------------------------
type Search struct {
Url string `json:"url"`
SpaceReplacement string `json:"spaceReplacement"` // character used to replace a space in the user input (usually "-" or "+")
CategorySpecificAttributes CategorySpecificAttributes `json:"categorySpecificAttributes"`
Method string `json:"method"` // POST or GET
ItemKeys ItemKeys `json:"itemKeys"`
PostFields PostFields `json:"postFields"`
}
type CategorySpecificAttributes struct {
Name string `json:"name"`
Values map[string]string `json:"values"`
}
type ItemKeys struct {
Root string `json:"root"`
Name string `json:"name"`
Thumbnail Thumbnail `json:"thumbnail"`
Link string `json:"link"`
Metadata map[string]string `json:"metadata"`
}
type Thumbnail struct {
Key string `json:"key"`
Attribute string `json:"attribute"`
AppendToSiteUrl bool `json:"appendToSiteUrl"`
// not handled yet in the code, but it means that the thumbnail is on the item's page
OnItemPage bool `json:"onItemPage"`
}
type PostFields struct {
Input string `json:"input"`
Generic map[string]string `json:"generic"`
}
// ----------------------------------------------
// ----------------------------------------------
type Login struct {
Url string `json:"url"`
HomeUrl string `json:"homeUrl"` // if a token is needed to be sent when logging in (to witness that the user visited the website and isn't just sending login requests)
CredsFormat string `json:"credsFormat"`
Fields []string `json:"fields"` // fields of the login form
PageInputs map[string]string `json:"pageInputs"` // inputs for the fields of the login form, either this or Fields is used, depending on the login method used
LoginButton string `json:"loginButton"` //only used if PageInputs is used
GenericFields map[string]string `json:"genericFields"`
ServerGeneratedFields []string `json:"serverGeneratedFields"`
Headers map[string]string `json:"headers"`
AuthMethod string `json:"authMethod"`
TokenLifespan int `json:"tokenLifespan"`
Tokens []string `json:"tokens"`
}
// ----------------------------------------------