-
-
Save namphamdev/8cfbd3920b009d63a5366c8ca48fc074 to your computer and use it in GitHub Desktop.
Revisions
-
tanaikech revised this gist
Mar 4, 2024 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,4 +116,3 @@ curl -L "https://drive.usercontent.google.com/download?id={fileId}&confirm=xxx" ## Testing - August 3, 2022: I could confirm that the method on February 17, 2022, can be still available. - March 4, 2024: I could confirm that the method on January 21, 2024, can be still available. -
tanaikech revised this gist
Mar 4, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -115,3 +115,5 @@ curl -L "https://drive.usercontent.google.com/download?id={fileId}&confirm=xxx" ## Testing - August 3, 2022: I could confirm that the method on February 17, 2022, can be still available. - March 4, 2024: I could confirm that the method on January 21, 2024, can be still available. - -
tanaikech revised this gist
Jan 21, 2024 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -85,6 +85,33 @@ Recently, it seems that the specification of this flow has been changed. So I up - Also, [goodls](https://github.com/tanaikech/goodls) was updated to v1.2.8. ## Updated at January 21, 2024 From the following @excellproj 's comment, > January 2024 > curl -L "https://drive.usercontent.google.com/download?id=${fileId}&export=download&confirm=t" -o "file.zip" > working great for me. Small and large files I checked this endpoint. By this, the following result is obtained. In the current stage, the following endpoint can be used. ``` https://drive.usercontent.google.com/download?id={fileId}&confirm=xxx ``` It seems that various values can be used to `xxx` of `confirm=xxx`. So, even `confirm=xxx` and `confirm=yy` and `confirm=z` can be used. The sample curl command is as follows. ```bash curl "https://drive.usercontent.google.com/download?id={fileId}&confirm=xxx" -o filename ``` And/or, ```bash curl -L "https://drive.usercontent.google.com/download?id={fileId}&confirm=xxx" -o filename ``` ## Testing - August 3, 2022: I could confirm that the method on February 17, 2022, can be still available. -
tanaikech revised this gist
Aug 3, 2022 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -84,3 +84,7 @@ Recently, it seems that the specification of this flow has been changed. So I up curl -L "https://drive.google.com/uc?export=download&id=### fileId ###" -o sampleoutput.csv - Also, [goodls](https://github.com/tanaikech/goodls) was updated to v1.2.8. ## Testing - August 3, 2022: I could confirm that the method on February 17, 2022, can be still available. -
tanaikech revised this gist
Feb 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,4 +83,4 @@ Recently, it seems that the specification of this flow has been changed. So I up curl -L "https://drive.google.com/uc?export=download&id=### fileId ###" -o sampleoutput.csv - Also, [goodls](https://github.com/tanaikech/goodls) was updated to v1.2.8. -
tanaikech revised this gist
Feb 17, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,3 +83,4 @@ Recently, it seems that the specification of this flow has been changed. So I up curl -L "https://drive.google.com/uc?export=download&id=### fileId ###" -o sampleoutput.csv - Also, [goodls](https://github.com/tanaikech/goodls) was updated. -
tanaikech revised this gist
Feb 17, 2022 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,3 +64,22 @@ If you will use a CLI tool, please use this. This is a CLI tool to download shar - [https://github.com/tanaikech/goodls](https://github.com/tanaikech/goodls) ## Updated at February 17, 2022 Recently, it seems that the specification of this flow has been changed. So I updated this answer. **In order to download a publicly shared file of large size from Google Drive, you can use the following script.** #!/bin/bash fileid="### file id ###" filename="MyFile.csv" html=`curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}"` curl -Lb ./cookie "https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\-_]+)'`&id=${fileid}" -o ${filename} - In this case, the ID for downloading is retrieved from the HTML data as follows. <form id="downloadForm" action="https://drive.google.com/uc?export=download&id={fileId}&confirm={value for downloading}" method="post"> - **When you want to download a publicly shared file of small size from Google Drive, you can use the following command.** curl -L "https://drive.google.com/uc?export=download&id=### fileId ###" -o sampleoutput.csv -
tanaikech revised this gist
Mar 21, 2019 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,3 +45,22 @@ By using this method, you can download files with the size of over 1 GB. Reference: [http://qiita.com/netwing/items/f2a595389f39206235e8](http://qiita.com/netwing/items/f2a595389f39206235e8) ## Update at March 21, 2019 ### sample script This is a simple bash script. ```bash #!/bin/bash fileid="### file id ###" filename="MyFile.csv" curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename} ``` Reference: [https://stackoverflow.com/questions/48133080/how-to-download-a-google-drive-url-via-curl-or-wget/48133859#48133859](https://stackoverflow.com/questions/48133080/how-to-download-a-google-drive-url-via-curl-or-wget/48133859#48133859) ### CLI tool If you will use a CLI tool, please use this. This is a CLI tool to download shared files and folders from Google Drive. For large file, the resumable download can be also run. - [https://github.com/tanaikech/goodls](https://github.com/tanaikech/goodls) -
tanaikech revised this gist
Aug 5, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,6 +41,7 @@ curl -b ./cookie.txt -L -o ${filename} "https://drive.google.com${query}" The value of ``confirm`` is changed every time. So when the value of ``confirm`` is retrieved, the cookie is saved using ``-c ./cookie.txt``, and when the file is downloaded, the cookie has to be read using ``-b ./cookie.txt``. By using this method, you can download files with the size of over 1 GB. Reference: [http://qiita.com/netwing/items/f2a595389f39206235e8](http://qiita.com/netwing/items/f2a595389f39206235e8) -
tanaikech created this gist
Aug 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ # Downloading Shared Files on Google Drive Using Curl When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about **40MB**. ### File size < 40MB #### CURL ~~~bash filename="### filename ###" fileid="### file ID ###" curl -L -o ${filename} "https://drive.google.com/uc?export=download&id=${fileid}" ~~~ ### File size > 40MB When it tries to download the file with more than 40MB, Google says to download from following URL. ~~~html <a id="uc-download-link" class="goog-inline-block jfk-button jfk-button-action" href="/uc?export=download&confirm=####&id=### file ID ###">download</a> ~~~ Query included ``confirm=####`` is important for downloading the files with large size. In order to retrieve the query from the HTML, it uses [``pup``](https://github.com/EricChiang/pup). ~~~bash pup 'a#uc-download-link attr{href}' ~~~ And ``sed`` is used to remove ``amp;``. ~~~bash sed -e 's/amp;//g'` ~~~ So curl command is as follows. #### CURL ~~~bash filename="### filename ###" fileid="### file ID ###" query=`curl -c ./cookie.txt -s -L "https://drive.google.com/uc?export=download&id=${fileid}" | pup 'a#uc-download-link attr{href}' | sed -e 's/amp;//g'` curl -b ./cookie.txt -L -o ${filename} "https://drive.google.com${query}" ~~~ The value of ``confirm`` is changed every time. So when the value of ``confirm`` is retrieved, the cookie is saved using ``-c ./cookie.txt``, and when the file is downloaded, the cookie has to be read using ``-b ./cookie.txt``. Reference: [http://qiita.com/netwing/items/f2a595389f39206235e8](http://qiita.com/netwing/items/f2a595389f39206235e8)