-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.go
62 lines (50 loc) · 1.07 KB
/
search.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
package search
import (
"github.com/PuerkitoBio/goquery"
)
type SearchMode struct {
Key string
Available bool
SupportedParams []string
}
//An instance of a search
type Instance interface {
GetStartingIndex() int
GetResults() []ExternalResultItem
SetStartIndex(key interface{}, i int)
SetResults(extracted []ExternalResultItem)
SetId(val string)
}
type Search struct {
DOM *goquery.Selection
Id string
currentPage int
StartIndex int
Results []ExternalResultItem
}
func (s *Search) GetStartingIndex() int {
return s.StartIndex
}
func (s *Search) GetDocument() *goquery.Selection {
return s.DOM
}
func (s *Search) SetStartIndex(key interface{}, i int) {
s.StartIndex = i
}
func (s *Search) GetResults() []ExternalResultItem {
return s.Results
}
func (s *Search) SetResults(results []ExternalResultItem) {
s.Results = results
}
func (s *Search) SetId(val string) {
s.Id = val
}
type PaginationSearch struct {
PageCount uint
StartingPage uint
}
type RunOptions struct {
MaxRequestsPerSecond uint
StopOnStaleTorrents bool
}