aboutsummaryrefslogtreecommitdiffstats
path: root/drive/url.go
diff options
context:
space:
mode:
Diffstat (limited to 'drive/url.go')
-rw-r--r--drive/url.go26
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)
+}