diff options
| author | Petter Rasmussen | 2016-01-17 21:38:08 +0100 | 
|---|---|---|
| committer | Petter Rasmussen | 2016-01-17 21:38:08 +0100 | 
| commit | 1d1dd76cedc719b90cbd131d01c939a17b879648 (patch) | |
| tree | 3dac26dbfa4d1a55d192b1bd55fb86c42440747e /drive | |
| parent | f35fd0892688ff638b30dcd48fdd56b9e2627cf1 (diff) | |
| download | gdrive-1d1dd76cedc719b90cbd131d01c939a17b879648.tar.bz2 | |
Implement url
Diffstat (limited to 'drive')
| -rw-r--r-- | drive/url.go | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/drive/url.go b/drive/url.go new file mode 100644 index 0000000..2dc429d --- /dev/null +++ b/drive/url.go @@ -0,0 +1,26 @@ +package drive + +import ( +    "fmt" +) + +type UrlArgs struct { +    FileId string     +    DownloadUrl bool     +} + +func (self *Drive) Url(args UrlArgs) { +    if args.DownloadUrl { +        fmt.Println(downloadUrl(args.FileId)) +        return +    } +    fmt.Println(previewUrl(args.FileId)) +} + +func previewUrl(id string) string { +    return fmt.Sprintf("https://drive.google.com/uc?id=%s", id) +} + +func downloadUrl(id string) string { +    return fmt.Sprintf("https://drive.google.com/uc?id=%s&export=download", id) +}  | 
