-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
1750 lines (1461 loc) · 106 KB
/
test.html
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!-- saved from url=(0100)http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api -->
<html itemscope="" itemtype="http://schema.org/QAPage"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>java - Direct download from Google Drive using Google Drive API - Stack Overflow</title>
<link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico?v=00a326f96f68">
<link rel="apple-touch-icon image_src" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png?v=41f6e13ade69">
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="http://stackoverflow.com/opensearch.xml">
<meta name="twitter:card" content="summary">
<meta name="twitter:domain" content="stackoverflow.com">
<meta property="og:type" content="website">
<meta property="og:image" itemprop="image primaryImageOfPage" content="http://cdn.sstatic.net/stackoverflow/img/[email protected]?v=ea71a5211a91">
<meta name="twitter:title" property="og:title" itemprop="title name" content="Direct download from Google Drive using Google Drive API">
<meta name="twitter:description" property="og:description" itemprop="description" content="My desktop application, written in java, tries to download public files from Google Drive. As i found out, it can be implemented by using file's webContentLink (it's for ability to download public ...">
<meta property="og:url" content="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api">
<link rel="canonical" href="./test_files/test.html">
<script type="text/javascript" async="" src="./test_files/ados"></script><script async="" src="./test_files/quant.js"></script><script async="" src="./test_files/beacon.js"></script><script async="" src="./test_files/analytics.js"></script><script type="text/javascript" async="" src="./test_files/ados.js"></script><script src="./test_files/jquery.min.js"></script>
<script src="./test_files/stub.en.js"></script>
<link rel="stylesheet" type="text/css" href="./test_files/all.css">
<link rel="alternate" type="application/atom+xml" title="Feed for question 'Direct download from Google Drive using Google Drive API'" href="http://stackoverflow.com/feeds/question/20665881">
<meta name="twitter:app:country" content="US">
<meta name="twitter:app:name:iphone" content="Stack Exchange iOS">
<meta name="twitter:app:id:iphone" content="871299723">
<meta name="twitter:app:url:iphone" content="se-zaphod://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api">
<meta name="twitter:app:name:ipad" content="Stack Exchange iOS">
<meta name="twitter:app:id:ipad" content="871299723">
<meta name="twitter:app:url:ipad" content="se-zaphod://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api">
<meta name="twitter:app:name:googleplay" content="Stack Exchange Android">
<meta name="twitter:app:url:googleplay" content="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api">
<meta name="twitter:app:id:googleplay" content="com.stackexchange.marvin">
<script>
StackExchange.ready(function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.initSnippetRenderer();
});
StackExchange.using("postValidation", function () {
StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
});
StackExchange.question.init({showAnswerHelp:true,totalCommentCount:0,shownCommentCount:0,highlightColor:'#F4A83D',backgroundColor:'#FFF',questionId:20665881});
styleCode();
StackExchange.realtime.subscribeToQuestion('1', '20665881');
});
</script>
<script>
StackExchange.init({"locale":"en","stackAuthUrl":"https://stackauth.com","serverTime":1424890142,"networkMetaHostname":"meta.stackexchange.com","routeName":"Questions/Show","styleCode":true,"enableUserHovercards":true,"snippets":{"enabled":true,"domain":"stacksnippets.net"},"site":{"name":"Stack Overflow","description":"Q&A for professional and enthusiast programmers","isNoticesTabEnabled":true,"recaptchaPublicKey":"6LdchgIAAAAAAJwGpIzRQSOFaO0pU6s44Xt8aTwc","recaptchaAudioLang":"en","enableNewTagCreationWarning":true,"insertSpaceAfterNameTabCompletion":false,"nonAsciiTags":true,"enableSocialMediaInSharePopup":true},"user":{"fkey":"d63254bb448b982bf3aa461a84a7cf37","isAnonymous":true}});
StackExchange.using.setCacheBreakers({"js/prettify-full.en.js":"b578a5f37af2","js/moderator.en.js":"00c77772b484","js/full-anon.en.js":"99b7c440ea87","js/full.en.js":"84e0a0f40d71","js/wmd.en.js":"0ce2db6f61dc","js/third-party/jquery.autocomplete.min.js":"e5f01e97f7c3","js/third-party/jquery.autocomplete.min.en.js":"","js/mobile.en.js":"581b1fb236a7","js/help.en.js":"b5f40fd81205","js/tageditor.en.js":"a6af4d441c80","js/tageditornew.en.js":"f6330ac948a1","js/inline-tag-editing.en.js":"48f13b102998","js/revisions.en.js":"255b536e5531","js/review.en.js":"fd737b380457","js/tagsuggestions.en.js":"bc2c996faeda","js/post-validation.en.js":"05d95aa50062","js/explore-qlist.en.js":"e7a80905fa22","js/events.en.js":"4931ed1a6c3c","js/keyboard-shortcuts.en.js":"ec062cf22935","js/external-editor.en.js":"b04e37426de6","js/external-editor.en.js":"b04e37426de6","js/snippet-javascript.en.js":"d96bb0bac213","js/snippet-javascript-codemirror.en.js":"c243a2819f64"});
StackExchange.using("gps", function() {
StackExchange.gps.init(true);
});
</script>
<script>
StackExchange.ready(function () {
$('#nav-tour').click(function () {
StackExchange.using("gps", function() {
StackExchange.gps.track("aboutpage.click", { aboutclick_location: "headermain" }, true);
});
});
});
</script>
<script async="" src="./test_files/full-anon.en.js"></script><script async="" src="./test_files/snippet-javascript.en.js"></script><script async="" src="./test_files/post-validation.en.js"></script><script async="" src="./test_files/prettify-full.en.js"></script><script async="" src="./test_files/external-editor.en.js"></script><script type="text/javascript" src="./test_files/adFeedback.js"></script><link rel="stylesheet" href="http://static.adzerk.net/Extensions/adFeedback.css"><link type="text/css" rel="stylesheet" href="./test_files/jobs.min.css"></head>
<body class="question-page new-topbar">
<noscript><div id="noscript-padding"></div></noscript>
<div id="notify-container"></div>
<div id="overlay-header"></div>
<div id="custom-header"></div>
<div class="topbar">
<div class="topbar-wrapper">
<div class="js-topbar-dialog-corral">
<div class="topbar-dialog siteSwitcher-dialog dno">
<div class="header">
<h3><a href="http://stackoverflow.com/">current community</a></h3>
</div>
<div class="modal-content current-site-container">
<ul class="current-site">
<li>
<div class="related-links">
<a href="http://chat.stackoverflow.com/" class="js-gps-track" data-gps-track="site_switcher.click({ item_type:6 })">chat</a>
<a href="http://blog.stackoverflow.com/" class="js-gps-track" data-gps-track="site_switcher.click({ item_type:7 })">blog</a>
</div>
<a href="http://stackoverflow.com/" class="current-site-link site-link js-gps-track" data-id="1" data-gps-track="
site_switcher.click({ item_type:3 })">
<div class="site-icon favicon favicon-stackoverflow" title="Stack Overflow"></div>
Stack Overflow
</a>
</li>
<li class="related-site">
<div class="L-shaped-icon-container">
<span class="L-shaped-icon"></span>
</div>
<a href="http://meta.stackoverflow.com/" class="site-link js-gps-track" data-id="552" data-gps-track="
site.switch({ target_site:552, item_type:3 }),
site_switcher.click({ item_type:4 })">
<div class="site-icon favicon favicon-stackoverflowmeta" title="Meta Stack Overflow"></div>
Meta Stack Overflow
</a>
</li>
<li class="related-site">
<div class="L-shaped-icon-container">
<span class="L-shaped-icon"></span>
</div>
<a class="site-link js-gps-track" href="http://careers.stackoverflow.com/?utm_source=stackoverflow.com&utm_medium=site-ui&utm_campaign=multicollider" data-gps-track="site_switcher.click({ item_type:9 })">
<div class="site-icon favicon favicon-careers" title="Stack Overflow Careers"></div>
Stack Overflow Careers
</a>
</li>
</ul>
</div>
<div class="header" id="your-communities-header">
<h3>
your communities </h3>
</div>
<div class="modal-content" id="your-communities-section">
<div class="call-to-login">
<a href="https://stackoverflow.com/users/signup?returnurl=http%3a%2f%2fstackoverflow.com%2fquestions%2f20665881%2fdirect-download-from-google-drive-using-google-drive-api" class="login-link js-gps-track" data-gps-track="site_switcher.click({ item_type:10 })">Sign up</a> or <a href="https://stackoverflow.com/users/login?returnurl=http%3a%2f%2fstackoverflow.com%2fquestions%2f20665881%2fdirect-download-from-google-drive-using-google-drive-api" class="login-link js-gps-track" data-gps-track="site_switcher.click({ item_type:11 })">log in</a> to customize your list.
</div>
</div>
<div class="header">
<h3><a href="http://stackexchange.com/sites">more stack exchange communities</a></h3>
</div>
<div class="modal-content">
<div class="child-content"></div>
</div>
</div>
</div>
<div class="network-items">
<a href="http://stackexchange.com/" class="topbar-icon icon-site-switcher yes-hover js-site-switcher-button js-gps-track" data-gps-track="site_switcher.show" title="A list of all 137 Stack Exchange sites">
<span class="hidden-text">Stack Exchange</span>
</a>
</div>
<div class="topbar-links">
<div class="links-container">
<span class="topbar-menu-links">
<a href="https://stackoverflow.com/users/signup?returnurl=http%3a%2f%2fstackoverflow.com%2fquestions%2f20665881%2fdirect-download-from-google-drive-using-google-drive-api" class="login-link">sign up</a>
<a href="https://stackoverflow.com/users/login?returnurl=http%3a%2f%2fstackoverflow.com%2fquestions%2f20665881%2fdirect-download-from-google-drive-using-google-drive-api" class="login-link">log in</a>
<a href="http://stackoverflow.com/tour">tour</a>
<a href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" class="icon-help js-help-button" title="Help Center and other resources">
help
<span class="triangle"></span>
</a>
<div class="topbar-dialog help-dialog js-help-dialog dno">
<div class="modal-content">
<ul>
<li>
<a href="http://stackoverflow.com/tour" class="js-gps-track" data-gps-track="help_popup.click({ item_type:1 })">
Tour
<span class="item-summary">
Start here for a quick overview of the site
</span>
</a>
</li>
<li>
<a href="http://stackoverflow.com/help" class="js-gps-track" data-gps-track="help_popup.click({ item_type:4 })">
Help Center
<span class="item-summary">
Detailed answers to any questions you might have
</span>
</a>
</li>
<li>
<a href="http://meta.stackoverflow.com/" class="js-gps-track" data-gps-track="help_popup.click({ item_type:2 })">
Meta
<span class="item-summary">
Discuss the workings and policies of this site
</span>
</a>
</li>
</ul>
</div>
</div>
<a href="http://careers.stackoverflow.com/?utm_source=stackoverflow.com&utm_medium=site-ui&utm_campaign=anon-topbar">stack overflow careers</a>
</span>
</div>
<div class="search-container">
<form id="search" action="http://stackoverflow.com/search" method="get" autocomplete="off">
<input name="q" type="text" placeholder="search" value="" tabindex="1" autocomplete="off" maxlength="240">
</form>
</div>
</div>
</div>
</div>
<script>
StackExchange.ready(function() { StackExchange.topbar.init(); });
</script>
<div class="container">
<div id="header">
<br class="cbt">
<div id="hlogo">
<a href="http://stackoverflow.com/">
Stack Overflow
</a>
</div>
<div id="hmenus">
<div class="nav mainnavs">
<ul>
<li class="youarehere"><a id="nav-questions" href="http://stackoverflow.com/questions">Questions</a></li>
<li><a id="nav-tags" href="http://stackoverflow.com/tags">Tags</a></li>
<li><a id="nav-users" href="http://stackoverflow.com/users">Users</a></li>
<li><a id="nav-badges" href="http://stackoverflow.com/help/badges">Badges</a></li>
<li><a id="nav-unanswered" href="http://stackoverflow.com/unanswered">Unanswered</a></li>
</ul>
</div>
<div class="nav askquestion">
<ul>
<li>
<a id="nav-askquestion" href="http://stackoverflow.com/questions/ask">Ask Question</a>
</li>
</ul>
</div>
</div>
</div>
<div id="content" class="snippet-hidden">
<div itemscope="" itemtype="http://schema.org/Question">
<link itemprop="image" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
<!--googleoff: all-->
<div id="herobox-mini">
<div id="hero-content">
<span id="controls">
<a href="http://stackoverflow.com/tour" id="tell-me-more" class="button">Take the 2-minute tour</a>
<span id="close"><a title="click to dismiss">×</a></span>
</span>
<div id="blurb">
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
</div>
</div>
<script>
$('#tell-me-more').click(function () {
var clickSource = $("body").attr("class") + '-mini';
if ($("body").hasClass("questions-page")) {
clickSource = 'questionpagemini';
} else if ($("body").hasClass("question-page")) {
clickSource = 'questionpagemini';
} else if ($("body").hasClass("home-page")) {
clickSource = 'homepagemini';
}
StackExchange.using("gps", function () {
StackExchange.gps.track("aboutpage.click", { aboutclick_location: clickSource } , true);
});
});
$('#herobox-mini #close').click(function () {
StackExchange.using("gps", function () {
StackExchange.gps.track("hero.action", { hero_action_type: "close" }, true);
});
$.cookie("hero", "none", { path: "/", expires: 365 });
var $hero = $("#herobox-mini");
$hero.slideUp('fast', function () { $hero.remove(); });
return false;
});
</script>
</div>
<!--googleon: all-->
<div id="question-header">
<h1 itemprop="name"><a href="./test_files/test.html" class="question-hyperlink">Direct download from Google Drive using Google Drive API</a></h1>
</div>
<div id="mainbar">
<div class="question" data-questionid="20665881" id="question">
<script>
var ados = ados || {};ados.run = ados.run || [];
ados.run.push(function() { ados_add_placement(22,8277,"adzerk1063964604",4).setZone(43) ; });
</script>
<div class="everyonelovesstackoverflow adzerk-vote" id="adzerk1063964604"><a href="http://engine.adzerk.net/r?e=eyJhdiI6NDI3LCJhdCI6NCwiYnQiOjAsImNtIjoxOTI3NjcsImNoIjoxMTc4LCJjciI6NzE1MDY1LCJkaSI6IjQ1ZWUxODZkNTFkMjQ1NjQ5NDI0MGQ5Y2Y0YjU3MGUxIiwiZG0iOjEsImZjIjo3NDM1MjAsImZsIjo0Mjk2MTQsImlwIjoiMjQuMTE0LjI1NS4zIiwia3ciOiJqYXZhLGdvb2dsZS1kcml2ZS1zZGsiLCJtayI6ImphdmEiLCJudyI6MjIsInBjIjowLCJwciI6NzY1LCJydCI6MiwicmYiOiJodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzI1MDEwMzY5L3dnZXQtY3VybC1sYXJnZS1maWxlLWZyb20tZ29vZ2xlLWRyaXZlIiwic3QiOjgyNzcsInVrIjoidWUxLWQ2MWVmYzI4YWEzNjQyMmE4MmQyMjFmMjM3NGYyNWMwIiwiem4iOjQzLCJ0cyI6MTQyNDg5MDE0Mjc1NSwiYmYiOnRydWUsInBuIjoiYWR6ZXJrMTA2Mzk2NDYwNCIsInVyIjoiaHR0cDovL3d3dy5hc3Bvc2UuY29tL3RvdGFsLWNvbXBvbmVudC1zdWl0ZS1qYXZhLmFzcHg_dXRtX3NvdXJjZT1zdGFja292ZXJmbG93JnV0bV9tZWRpdW09YmFubmVyJnV0bV9jYW1wYWlnbj1zbyUyMGphdmElMjB0b3AifQ&s=ROyheQ5fdqAPDZ6jRGDj9z8NVP8" rel="nofollow" target="_blank" title=""><img src="./test_files/24cda4a974114617a0dac43be43245c7.gif" title="" alt="" border="0" width="728" height="90"></a><div class="adzerk-vote-controls" style="display: none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input type="radio" value="12" name="downvoteReason">Uninteresting</label></li><li><label><input type="radio" value="13" name="downvoteReason">Misleading</label></li><li><label><input type="radio" value="14" name="downvoteReason">Offensive</label></li><li><label><input type="radio" value="15" name="downvoteReason">Repetitive</label></li><li><label><input type="radio" value="16" name="downvoteReason">Other</label></li></ul><a href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img height="0px" width="0px" border="0" style="position:absolute;" src="./test_files/i.gif"></div> <table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="20665881">
<a class="vote-up-off" title="This question shows research effort; it is useful and clear">up vote</a>
<span itemprop="upvoteCount" class="vote-count-post ">4</span>
<a class="vote-down-off" title="This question does not show any research effort; it is unclear or not useful">down vote</a>
<a class="star-off" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" title="This is a favorite question (click again to undo)">favorite</a>
<div class="favoritecount"><b>3</b></div>
</div>
</td>
<td class="postcell">
<div>
<div class="post-text" itemprop="text">
<p>My desktop application, written in java, tries to download public files from Google Drive. As i found out, it can be implemented by using file's <code>webContentLink</code> (it's for ability to download public files without user authorization).</p>
<p>So, the code below works with small files:</p>
<pre class="lang-java prettyprint prettyprinted"><code><span class="typ">String</span><span class="pln"> webContentLink </span><span class="pun">=</span><span class="pln"> aFile</span><span class="pun">.</span><span class="pln">getWebContentLink</span><span class="pun">();</span><span class="pln">
</span><span class="typ">InputStream</span><span class="pln"> in </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> URL</span><span class="pun">(</span><span class="pln">webContentLink</span><span class="pun">).</span><span class="pln">openStream</span><span class="pun">();</span></code></pre>
<p>But it doesn't work on big files, because in this case file can't be downloaded directly via <code>webContentLink</code> without user confirmation with google virus scan warning. See an example: <a href="https://docs.google.com/uc?id=0B2afXDJXPSdpZTN4cTVPN2VrZDg&export=download" rel="nofollow">web content link</a>.</p>
<p>So my question is how to get content of a public file from Google Drive without user authorization?</p>
</div>
<div class="post-taglist">
<a href="http://stackoverflow.com/questions/tagged/java" class="post-tag js-gps-track" title="show questions tagged 'java'" rel="tag">java</a> <a href="http://stackoverflow.com/questions/tagged/google-drive-sdk" class="post-tag js-gps-track" title="show questions tagged 'google-drive-sdk'" rel="tag"><img src="./test_files/9HWwT.png" height="16" width="18" alt="" class="sponsor-tag-img">google-drive-sdk</a>
</div>
<table class="fw">
<tbody><tr>
<td class="vt">
<div class="post-menu"><a href="http://stackoverflow.com/q/20665881" title="short permalink to this question" class="short-link" id="link-post-20665881">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/20665881/edit" class="suggest-edit-post" title="">improve this question</a></div>
</td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
<a href="http://stackoverflow.com/posts/20665881/revisions" title="show all edits to this post">edited <span title="2013-12-19 17:15:35Z" class="relativetime">Dec 19 '13 at 17:15</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<br>
</div>
</div> </td>
<td class="post-signature owner">
<div class="user-info ">
<div class="user-action-time">
asked <span title="2013-12-18 18:39:21Z" class="relativetime">Dec 18 '13 at 18:39</span>
</div>
<div class="user-gravatar32">
<a href="http://stackoverflow.com/users/3084258/philip-voronov"><div class="gravatar-wrapper-32"><img src="./test_files/J4DtY.jpg" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="http://stackoverflow.com/users/3084258/philip-voronov">Philip Voronov</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">1,140</span><span title="1 gold badge"><span class="badge1"></span><span class="badgecount">1</span></span><span title="4 silver badges"><span class="badge2"></span><span class="badgecount">4</span></span><span title="11 bronze badges"><span class="badge3"></span><span class="badgecount">11</span></span>
</div>
</div>
</td>
</tr>
</tbody></table>
</div>
</td>
</tr>
<tr>
<td class="votecell"></td>
<td>
<div id="comments-20665881" class="comments dno">
<table>
<tbody data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">
<tr><td></td><td></td></tr>
</tbody>
</table>
</div>
<div id="comments-link-20665881" data-rep="50" data-anon="true">
<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.">add a comment</a><span class="js-link-separator dno"> | </span><a class="js-show-link comments-link dno" title="expand to show all comments on this post, or add one of your own" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" onclick=""></a>
</div>
</td>
</tr> </tbody></table>
</div>
<div id="answers">
<a name="tab-top"></a>
<div id="answers-header">
<div class="subheader answers-subheader">
<h2>
5 Answers
<span style="display:none;" itemprop="answerCount">5</span>
</h2>
<div>
<div id="tabs">
<a href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api?answertab=active#tab-top" title="Answers with the latest activity first">active</a>
<a href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api?answertab=oldest#tab-top" title="Answers in the order they were provided">oldest</a>
<a class="youarehere" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api?answertab=votes#tab-top" title="Answers with the highest score first">votes</a>
</div>
</div>
</div>
</div>
<a name="21390469"></a>
<div id="answer-21390469" class="answer accepted-answer" data-answerid="21390469" itemscope="" itemtype="http://schema.org/Answer" itemprop="acceptedAnswer">
<table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="21390469">
<a class="vote-up-off" title="This answer is useful">up vote</a>
<span itemprop="upvoteCount" class="vote-count-post ">13</span>
<a class="vote-down-off" title="This answer is not useful">down vote</a>
<span class="vote-accepted-on load-accepted-answer-date" title="loading when this answer was accepted...">accepted</span>
</div>
</td>
<td class="answercell">
<div class="post-text" itemprop="text">
<p>I just ran into this issue.</p>
<p>The <em>trick</em> is to treat your Google Drive folder like a web host.</p>
<p><del><a href="https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html">Which is intended functionality by Google</a></del> <br>
<a href="./test_files/ArDpc.png">new Google Drive Link</a>.</p>
<p>All you have to do is simple get the <strong>host</strong> URL for a publicly shared drive folder. To do this, you can upload a plain HTML file and <strong>preview</strong> it in Google Drive to find your host URL.</p>
<p>Here are the steps:</p>
<ol>
<li>Create a folder in Google Drive.<br><br></li>
<li>Share this drive publicly. <br><br>
<img src="./test_files/ArDpc.png" alt="enter image description here"><br><br></li>
<li>Upload a simple HTML file. Add any additional files (subfolders ok) <br><br>
<img src="./test_files/YzRgb.png" alt="enter image description here"><br><br></li>
<li>Open and "preview" the HTML file in Google Drive <br><br>
<img src="./test_files/wLibS.png" alt="enter image description here"><br><br></li>
<li>Get the URL address for this folder <br><br>
<img src="./test_files/AbWsU.png" alt="enter image description here"><br><br></li>
<li>Create a direct link URL from your URL folder base <br><br>
<img src="./test_files/l6HHv.png" alt="enter image description here"><br><br></li>
<li>This URL should allow direct downloads of your large files.<br><br></li>
</ol>
<p>[edit]</p>
<p>I forgot to add. If you use subfolders to organize your files, you simple use the folder name as you would expect in a URL hierarchy.</p>
<p><code>https://googledrive.com/host/<your public folders id string>/images/my-image.png</code></p>
<hr>
<p><strong>What I was looking to do</strong></p>
<p>I created a custom Debian image with Virtual Box for Vagrant. I wanted to share this ".box" file with colleagues so they could put the direct link into their Vagrantfile.</p>
<p>In the end, I needed a direct link to the actual file.</p>
<p><strong>Google Drive problem</strong></p>
<p>If you set the file permissions to be publicly available and create/generate a direct access link by using something like the <a href="https://sites.google.com/site/gdocs2direct/">gdocs2direct</a> tool or just crafting the link yourself:</p>
<p><code>https://docs.google.com/uc?export=download&id=<your file id></code></p>
<p>You will get a cookie based verification code and prompt "Google could not scan this file" prompt, which won't work for things such as <strong>wget</strong> or Vagrantfile configs.</p>
<p>The code that it generates is a simple code that appends GET query variable <code>...&confirm=###</code> to the string, but it's per user specific, so it's not like you can copy/paste that query variable for others.</p>
<p>But if you use the above "Web page hosting" method, you can get around that prompt.</p>
<p>I hope that helps!</p>
</div>
<table class="fw">
<tbody><tr>
<td class="vt">
<div class="post-menu"><a href="http://stackoverflow.com/a/21390469" title="short permalink to this answer" class="short-link" id="link-post-21390469">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/21390469/edit" class="suggest-edit-post" title="">improve this answer</a></div> </td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
<a href="http://stackoverflow.com/posts/21390469/revisions" title="show all edits to this post">edited <span title="2014-09-08 17:51:17Z" class="relativetime">Sep 8 '14 at 17:51</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<br>
</div>
</div> </td>
<td align="right" class="post-signature">
<div class="user-info user-hover">
<div class="user-action-time">
answered <span title="2014-01-27 20:00:32Z" class="relativetime">Jan 27 '14 at 20:00</span>
</div>
<div class="user-gravatar32">
<a href="http://stackoverflow.com/users/253564/jmbertucci"><div class="gravatar-wrapper-32"><img src="./test_files/b9656ad923293b17b976acef9e05185f" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="http://stackoverflow.com/users/253564/jmbertucci">jmbertucci</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">3,946</span><span title="1 gold badge"><span class="badge1"></span><span class="badgecount">1</span></span><span title="18 silver badges"><span class="badge2"></span><span class="badgecount">18</span></span><span title="33 bronze badges"><span class="badge3"></span><span class="badgecount">33</span></span>
</div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td class="votecell"></td>
<td>
<div id="comments-21390469" class="comments ">
<table>
<tbody data-remaining-comments-count="5" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">
<tr id="comment-32263548" class="comment ">
<td>
<table>
<tbody>
<tr>
<td class=" comment-score">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">Great thanks for your answer! Unfortunately, this folders created by my app so this tricks must be handled by using Google API (if it allows this tricks at all), but I discovered really pretty cool things about Google Drive from your answer. Thanks a lot!</span>
–
<a href="http://stackoverflow.com/users/3084258/philip-voronov" title="1140 reputation" class="comment-user owner">Philip Voronov</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment32263548_21390469"><span title="2014-01-27 20:30:05Z" class="relativetime-clean">Jan 27 '14 at 20:30</span></a></span>
</div>
</td>
</tr>
<tr id="comment-32263771" class="comment ">
<td class="comment-actions">
<table>
<tbody>
<tr>
<td class=" comment-score">
<span title="number of 'useful comment' votes received" class="cool">1</span>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">I'm not familiar with the Google API but the <a href="https://developers.google.com/drive/v2/reference/files" rel="nofollow">Google API Files</a> class appears to have a method called <code>webViewLink</code> which appears to return the public URL. That might get the URL for you programmatically? <a href="https://developers.google.com/drive/web/publish-site" rel="nofollow">This doc shows how to create public folders programmatically</a>. Perhaps that will help? Either way, I know you have an answer, I just wanted to add another solution for others who end up here (like I did). =)</span>
–
<a href="http://stackoverflow.com/users/253564/jmbertucci" title="3946 reputation" class="comment-user">jmbertucci</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment32263771_21390469"><span title="2014-01-27 20:36:31Z" class="relativetime-clean">Jan 27 '14 at 20:36</span></a></span>
<span class="edited-yes" title="this comment was edited 1 time"></span>
</div>
</td>
</tr>
<tr id="comment-32263915" class="comment ">
<td>
<table>
<tbody>
<tr>
<td class=" comment-score">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">yes, it helps. Thanks!!</span>
–
<a href="http://stackoverflow.com/users/3084258/philip-voronov" title="1140 reputation" class="comment-user owner">Philip Voronov</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment32263915_21390469"><span title="2014-01-27 20:40:43Z" class="relativetime-clean">Jan 27 '14 at 20:40</span></a></span>
</div>
</td>
</tr>
<tr id="comment-36091029" class="comment ">
<td class="comment-actions">
<table>
<tbody>
<tr>
<td class=" comment-score">
<span title="number of 'useful comment' votes received" class="cool">2</span>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">I don't think this works anymore as of a recent change. :(</span>
–
<a href="http://stackoverflow.com/users/18475/ferventcoder" title="3366 reputation" class="comment-user">ferventcoder</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment36091029_21390469"><span title="2014-05-07 20:24:11Z" class="relativetime-clean">May 7 '14 at 20:24</span></a></span>
</div>
</td>
</tr>
<tr id="comment-36092957" class="comment ">
<td class="comment-actions">
<table>
<tbody>
<tr>
<td class=" comment-score">
<span title="number of 'useful comment' votes received" class="cool">1</span>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">When I say doesn't work anymore, I'm talking about *.box files.</span>
–
<a href="http://stackoverflow.com/users/18475/ferventcoder" title="3366 reputation" class="comment-user">ferventcoder</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment36092957_21390469"><span title="2014-05-07 21:18:43Z" class="relativetime-clean">May 7 '14 at 21:18</span></a></span>
<span class="edited-yes" title="this comment was edited 1 time"></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="comments-link-21390469" data-rep="50" data-anon="true">
<a class="js-add-link comments-link dno" title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></a><span class="js-link-separator dno"> | </span><a class="js-show-link comments-link " title="expand to show all comments on this post, or add one of your own" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" onclick="">show <b>5</b> more comments</a>
</div>
</td>
</tr> </tbody></table>
</div>
<script>
var ados = ados || {};ados.run = ados.run || [];
ados.run.push(function() { ados_add_placement(22,8277,"adzerk1703911429",4).setZone(44) ; });
</script>
<div class="everyonelovesstackoverflow adzerk-vote" id="adzerk1703911429"><a href="http://engine.adzerk.net/r?e=eyJhdiI6NDE0LCJhdCI6NCwiYnQiOjAsImNtIjoxODY2MjQsImNoIjoxMTc4LCJjciI6Njk1NzM5LCJkaSI6IjU1NTliYmZhZTM0ODQ1MGNhNTRiYzQ5NTZiZGFhOTY2IiwiZG0iOjEsImZjIjo3MjE4MzMsImZsIjo0MzE3ODAsImlwIjoiMjQuMTE0LjI1NS4zIiwia3ciOiJqYXZhLGdvb2dsZS1kcml2ZS1zZGsiLCJudyI6MjIsInBjIjowLCJwciI6MTYwNCwicnQiOjEsInJmIjoiaHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL3F1ZXN0aW9ucy8yNTAxMDM2OS93Z2V0LWN1cmwtbGFyZ2UtZmlsZS1mcm9tLWdvb2dsZS1kcml2ZSIsInN0Ijo4Mjc3LCJ1ayI6InVlMS1kNjFlZmMyOGFhMzY0MjJhODJkMjIxZjIzNzRmMjVjMCIsInpuIjo0NCwidHMiOjE0MjQ4OTAxNDI3NTcsImJmIjp0cnVlLCJwbiI6ImFkemVyazE3MDM5MTE0MjkiLCJ1ciI6Imh0dHA6Ly9jYXJlZXJzLnN0YWNrb3ZlcmZsb3cuY29tL2pvYnMvcmVtb3RlP3V0bV9zb3VyY2U9c3RhY2tvdmVyZmxvdy5jb20mdXRtX21lZGl1bT1hZCZ1dG1fY2FtcGFpZ249Y2FuZGlkYXRlcy13ZmgmdXRtX2NvbnRlbnQ9bGItd2ZoLXBhamFtYXMifQ&s=HDntKQNgrk4N7iyaLN3hWEbIa1g" rel="nofollow" target="_blank" title=""><img src="./test_files/831a088cf67e42c580e407e2d91c8ce6.jpg" title="" alt="" border="0" width="728" height="90"></a><div class="adzerk-vote-controls" style="display:none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input type="radio" value="12" name="downvoteReason">Uninteresting</label></li><li><label><input type="radio" value="13" name="downvoteReason">Misleading</label></li><li><label><input type="radio" value="14" name="downvoteReason">Offensive</label></li><li><label><input type="radio" value="15" name="downvoteReason">Repetitive</label></li><li><label><input type="radio" value="16" name="downvoteReason">Other</label></li></ul><a href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img height="0px" width="0px" border="0" style="position:absolute;" src="./test_files/i(1).gif"></div>
<a name="20675299"></a>
<div id="answer-20675299" class="answer" data-answerid="20675299" itemscope="" itemtype="http://schema.org/Answer">
<table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="20675299">
<a class="vote-up-off" title="This answer is useful">up vote</a>
<span itemprop="upvoteCount" class="vote-count-post ">1</span>
<a class="vote-down-off" title="This answer is not useful">down vote</a>
</div>
</td>
<td class="answercell">
<div class="post-text" itemprop="text">
<p>Using a Service Account might work for you.</p>
</div>
<table class="fw">
<tbody><tr>
<td class="vt">
<div class="post-menu"><a href="http://stackoverflow.com/a/20675299" title="short permalink to this answer" class="short-link" id="link-post-20675299">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/20675299/edit" class="suggest-edit-post" title="">improve this answer</a></div> </td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
answered <span title="2013-12-19 06:58:38Z" class="relativetime">Dec 19 '13 at 6:58</span>
</div>
<div class="user-gravatar32">
<a href="http://stackoverflow.com/users/1000753/pinoyyid"><div class="gravatar-wrapper-32"><img src="./test_files/23634e7a38e353cca12bb72a4205615b" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="http://stackoverflow.com/users/1000753/pinoyyid">pinoyyid</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">5,458</span><span title="2 gold badges"><span class="badge1"></span><span class="badgecount">2</span></span><span title="12 silver badges"><span class="badge2"></span><span class="badgecount">12</span></span><span title="42 bronze badges"><span class="badge3"></span><span class="badgecount">42</span></span>
</div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td class="votecell"></td>
<td>
<div id="comments-20675299" class="comments ">
<table>
<tbody data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">
<tr id="comment-31036371" class="comment ">
<td>
<table>
<tbody>
<tr>
<td class=" comment-score">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">Yes, it works. Thanks a lot.</span>
–
<a href="http://stackoverflow.com/users/3084258/philip-voronov" title="1140 reputation" class="comment-user owner">Philip Voronov</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment31036371_20675299"><span title="2013-12-21 10:36:06Z" class="relativetime-clean">Dec 21 '13 at 10:36</span></a></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="comments-link-20675299" data-rep="50" data-anon="true">
<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.">add a comment</a><span class="js-link-separator dno"> | </span><a class="js-show-link comments-link dno" title="expand to show all comments on this post, or add one of your own" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" onclick=""></a>
</div>
</td>
</tr> </tbody></table>
</div>
<a name="20669545"></a>
<div id="answer-20669545" class="answer" data-answerid="20669545" itemscope="" itemtype="http://schema.org/Answer">
<table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="20669545">
<a class="vote-up-off" title="This answer is useful">up vote</a>
<span itemprop="upvoteCount" class="vote-count-post ">0</span>
<a class="vote-down-off" title="This answer is not useful">down vote</a>
</div>
</td>
<td class="answercell">
<div class="post-text" itemprop="text">
<p>I would consider downloading from the link, scraping the page that you get to grab the confirmation link, and then downloading that.</p>
<p>If you look at the "download anyway" URL it has an extra <code>confirm</code> query parameter with a seemingly randomly generated token. Since it's random...and you probably don't want to figure out how to generate it yourself, scraping might be the easiest way without knowing anything about how the site works.</p>
<p>You may need to consider various scenarios.</p>
</div>
<table class="fw">
<tbody><tr>
<td class="vt">
<div class="post-menu"><a href="http://stackoverflow.com/a/20669545" title="short permalink to this answer" class="short-link" id="link-post-20669545">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/20669545/edit" class="suggest-edit-post" title="">improve this answer</a></div> </td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
<a href="http://stackoverflow.com/posts/20669545/revisions" title="show all edits to this post">edited <span title="2013-12-18 22:20:01Z" class="relativetime">Dec 18 '13 at 22:20</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<br>
</div>
</div> </td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
answered <span title="2013-12-18 22:13:29Z" class="relativetime">Dec 18 '13 at 22:13</span>
</div>
<div class="user-gravatar32">
<a href="http://stackoverflow.com/users/536607/mxyl"><div class="gravatar-wrapper-32"><img src="./test_files/6c85d3a45108e6e92da9e68fa9d441ae" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="http://stackoverflow.com/users/536607/mxyl">MxyL</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">5,297</span><span title="9 gold badges"><span class="badge1"></span><span class="badgecount">9</span></span><span title="40 silver badges"><span class="badge2"></span><span class="badgecount">40</span></span><span title="90 bronze badges"><span class="badge3"></span><span class="badgecount">90</span></span>
</div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td class="votecell"></td>
<td>
<div id="comments-20669545" class="comments ">
<table>
<tbody data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">
<tr id="comment-30956447" class="comment ">
<td class="comment-actions">
<table>
<tbody>
<tr>
<td class=" comment-score">
<span title="number of 'useful comment' votes received" class="cool">1</span>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
<td class="comment-text">
<div style="display: block;" class="comment-body">
<span class="comment-copy">I've already considered this approach. But i'm developing a stable application and i don't want to rely on a hack, that can stop working at any moment. I hope the issue can be solved by using the Google API.</span>
–
<a href="http://stackoverflow.com/users/3084258/philip-voronov" title="1140 reputation" class="comment-user owner">Philip Voronov</a>
<span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#comment30956447_20669545"><span title="2013-12-19 04:33:05Z" class="relativetime-clean">Dec 19 '13 at 4:33</span></a></span>
<span class="edited-yes" title="this comment was edited 1 time"></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="comments-link-20669545" data-rep="50" data-anon="true">
<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.">add a comment</a><span class="js-link-separator dno"> | </span><a class="js-show-link comments-link dno" title="expand to show all comments on this post, or add one of your own" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" onclick=""></a>
</div>
</td>
</tr> </tbody></table>
</div>
<a name="24241516"></a>
<div id="answer-24241516" class="answer" data-answerid="24241516" itemscope="" itemtype="http://schema.org/Answer">
<table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="24241516">
<a class="vote-up-off" title="This answer is useful">up vote</a>
<span itemprop="upvoteCount" class="vote-count-post ">0</span>
<a class="vote-down-off" title="This answer is not useful">down vote</a>
</div>
</td>
<td class="answercell">
<div class="post-text" itemprop="text">
<p>If you just want to programmatically (as oppossed to giving the user a link to open in a browser) download a file through the Google Drive API, I would suggest using the <code>downloadUrl</code> of the file instead of the <code>webContentLink</code>, as documented here: <a href="https://developers.google.com/drive/web/manage-downloads" rel="nofollow">https://developers.google.com/drive/web/manage-downloads</a></p>
</div>
<table class="fw">
<tbody><tr>
<td class="vt">
<div class="post-menu"><a href="http://stackoverflow.com/a/24241516" title="short permalink to this answer" class="short-link" id="link-post-24241516">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/24241516/edit" class="suggest-edit-post" title="">improve this answer</a></div> </td>
<td align="right" class="post-signature">
<div class="user-info ">
<div class="user-action-time">
answered <span title="2014-06-16 10:24:04Z" class="relativetime">Jun 16 '14 at 10:24</span>
</div>
<div class="user-gravatar32">
<a href="http://stackoverflow.com/users/214004/david"><div class="gravatar-wrapper-32"><img src="./test_files/10751987594f437ab9dafcf7596055b5" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="http://stackoverflow.com/users/214004/david">David</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">379</span><span title="6 silver badges"><span class="badge2"></span><span class="badgecount">6</span></span><span title="10 bronze badges"><span class="badge3"></span><span class="badgecount">10</span></span>
</div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td class="votecell"></td>
<td>
<div id="comments-24241516" class="comments dno">
<table>
<tbody data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true">
<tr><td></td><td></td></tr>
</tbody>
</table>
</div>
<div id="comments-link-24241516" data-rep="50" data-anon="true">
<a class="js-add-link comments-link disabled-link " title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.">add a comment</a><span class="js-link-separator dno"> | </span><a class="js-show-link comments-link dno" title="expand to show all comments on this post, or add one of your own" href="http://stackoverflow.com/questions/20665881/direct-download-from-google-drive-using-google-drive-api#" onclick=""></a>
</div>
</td>
</tr> </tbody></table>
</div>
<a name="21379518"></a>
<div id="answer-21379518" class="answer" data-answerid="21379518" itemscope="" itemtype="http://schema.org/Answer">
<table>
<tbody><tr>
<td class="votecell">
<div class="vote">
<input type="hidden" name="_id_" value="21379518">