forked from fedir/yrank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (35 loc) · 903 Bytes
/
main.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
package main
import (
"fmt"
"github.com/fedir/yrank/youtube"
)
func main() {
// Getting configuration from configuration files and from CLI parameters
c := configuration()
cid, pid, of, s, d := cliParameters()
if d {
fmt.Printf("API key: %s\n", c.apikey)
}
// Statistics retrieve from Youtube
var rankedVideos []youtube.VideoStatistics
if cid != "" {
if d {
fmt.Printf("Channel ID: %s\n", cid)
}
rankedVideos = youtube.ChannelStatistics(cid, c.apikey, d)
} else if pid != "" {
if d {
fmt.Printf("Playlist ID: %s\n", pid)
}
rankedVideos = youtube.PlaylistStatistics(pid, c.apikey, "", d)
}
// Sorting
if s == "likes" {
youtube.SortByLikes(rankedVideos)
} else if s == "total-interest" {
youtube.SortByTotalInterestingness(rankedVideos)
} else if s == "positive-interest" {
youtube.SortByPositiveInterestingness(rankedVideos)
}
print(rankedVideos, of)
}