/
icloud.go
68 lines (57 loc) · 1.47 KB
/
icloud.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
package main
import (
"github.com/lwsanty/gophotocloud/engine"
//"github.com/lwsanty/gophotocloud/photos"
"fmt"
"github.com/bgentry/speakeasy"
"github.com/lwsanty/gophotocloud/drive"
"io/ioutil"
)
func main() {
cloudy, _ := ioutil.ReadFile("cloudy")
if cloudy != nil {
fmt.Println(string(cloudy))
}
login, err := speakeasy.Ask("enter your apple id: ")
if err != nil {
panic(err)
}
pass, err := speakeasy.Ask("enter your icloud pass: ")
if err != nil {
panic(err)
}
eng, err := engine.NewEngine(login, pass)
if err != nil {
panic(err)
}
fitems, cookie, token, err := drive.GetFolderItems(eng, "root")
if err != nil {
panic(err)
}
fitems_links, err := drive.GetFileItemsUrls(fitems, eng, cookie, token)
if err != nil {
panic(err)
}
fmt.Println("================================================================")
fmt.Println("================================================================")
fmt.Println("================================================================")
for i := range fitems_links.Items {
fmt.Println("name: ", fitems.Items[i].Name)
fmt.Println("type: ", fitems.Items[i].Type)
fmt.Println("url: ", fitems.Items[i].Url)
fmt.Println("id: ", fitems.Items[i].Id)
}
/*
iclouddrive, err2 := drive.NewD(eng)
if err2 != nil {
panic(err2)
}
fmt.Println(iclouddrive.Urls)
if err := photos.PrintContent(total); err != nil {
panic(err)
}
if err := photos.DownloadContent(total); err != nil {
panic(err)
}
*/
}