Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra pattern to extract url from download-form returned by Google Drive for a large file #308

Merged
merged 6 commits into from
Feb 1, 2024

Conversation

pmeier
Copy link
Contributor

@pmeier pmeier commented Jan 29, 2024

Fixes #43. They were a few attempts to solve this, but even with the latest gdown==5.0.1 the download still fails. The fixes so far have concentrated on cookies, but failed to realize that the original report is for large files for which GDrive asks for user confirmation since it cannot perform a virus check.

This PR addresses this part by properly parsing the confirmation form.

@wkentaro
Copy link
Owner

Reply to: #43 (comment)

@pmeier I'm accessing from Japan with the default user-agent, and I get this if I put a breakpoint:

gdown https://drive.google.com/uc?id=1r6o0pSROcV1_VwT4oSjA2FBUSCWGuxLK
<form action="https://drive.google.com/uc?id=1r6o0pSROcV1_VwT4oSjA2FBUSCWGuxLK&amp;confirm=t&amp;uuid=0c79e3bf-b223-4ad3-a3f3-4ec5f7bd38cd" id="download-form" method="post">
 <input class="goog-inline-block jfk-button jfk-button-action" id="uc-download-link" type="submit" value="Download anyway"/>
</form>

FYI, my breakpoint is here:
image

@pmeier
Copy link
Contributor Author

pmeier commented Jan 29, 2024

Huh, I guess there is regional difference. I'm accessing from Germany. Maybe that is the reason why so many people are still facing the issue, but you can't reproduce? Here is it for me:

screenshot from browser dev tools

image

print from breakpoint with manual formatting

<form action="https://drive.usercontent.google.com/download" id="download-form" method="get">
  <input class="goog-inline-block jfk-button jfk-button-action" id="uc-download-link" type="submit" value="Download anyway"/>
  <input name="id" type="hidden" value="1r6o0pSROcV1_VwT4oSjA2FBUSCWGuxLK"/>
  <input name="confirm" type="hidden" value="t"/>
  <input name="uuid" type="hidden" value="293715d8-4dfe-4f6a-be20-ce0d3e6308d7"/>
</form>

@pmeier
Copy link
Contributor Author

pmeier commented Jan 29, 2024

Anyway, the patch should work with both variants. It still respects the query parameters that are part of the original URL.

gdown/download.py Outdated Show resolved Hide resolved
@wkentaro wkentaro self-assigned this Jan 30, 2024
@wkentaro wkentaro added the enhancement for pr label Jan 30, 2024
@pmeier pmeier requested a review from wkentaro January 31, 2024 07:55
@wkentaro wkentaro changed the title fix url extraction for no virus scan confirmation Add extra pattern to extract url from download-form returned by Google Drive for a large file Feb 1, 2024
@wkentaro wkentaro merged commit cb1eff4 into wkentaro:main Feb 1, 2024
2 checks passed
@wkentaro
Copy link
Owner

wkentaro commented Feb 1, 2024

Thanks @pmeier!

@pmeier pmeier deleted the virus-scan branch February 1, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Permission denied ... Maybe you need to change permission over 'Anyone with the link'?
2 participants