-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtidal.go
76 lines (55 loc) · 1.31 KB
/
tidal.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
73
74
75
76
package main
import (
"fmt"
"io/ioutil"
"os"
"strconv"
"github.com/lucaslg26/tidal-go/pkg/tidal"
)
func main() {
uid, _ := strconv.Atoi(os.Getenv("USER_ID"))
Tidal := &tidal.Client{
Token: "4zx46pyr9o8qZNRw",
Username: os.Getenv("TIDAL_USERNAME"),
Password: os.Getenv("TIDAL_PASSWORD"),
SoundQuality: "LOSSLESS",
User: &tidal.User{
UserID: uid,
SessionID: os.Getenv("SESSION_ID"),
CountryCode: "BR",
},
}
//Tidal.Login()
fmt.Printf("%v\n", Tidal.User)
// search, _ := Tidal.Search("Garden Of The Titans")
// fmt.Println("Artists:")
// for _, v := range search.Artists.Items {
// fmt.Printf("%s\n", v.Name)
// }
// fmt.Println("Playlists:")
// for _, v := range search.Playlists.Items {
// fmt.Printf("%s\n", v.Title)
// }
// fmt.Println("Albums:")
// for _, v := range search.Albums.Items {
// fmt.Printf("%s\n", v.Title)
// }
// fmt.Println("Tracks:")
// for _, v := range search.Tracks.Items {
// fmt.Printf("%s\n", v.Title)
// }
track, err := Tidal.GetStream(&tidal.Track{ID: 1267842})
if err != nil {
fmt.Println(err)
}
media, err := Tidal.GetMedia(track)
if err != nil {
fmt.Println(err)
}
media.GetKey()
media.DecryptMedia()
err = ioutil.WriteFile("media/output.flac", media.Media, 0644)
if err != nil {
panic(err)
}
}