How to use wget to download files from Onedrive? (and batch files and entire folders, if possible)
There is one way that works for me (based on this tutorial: https://www.marstranslation.com/blog/how-to-make-direct-link-of-onedrive-files)
Right-click on the file you are interested in download (from web interface), and choose Embed.
Press "Generate HTML code to embed this file".
Copy the part contained in the
""of src is your link. This will look like .
download. This will look like https://onedrive.live.com/download?cid=6EBB03E38A53ED3E&resid=6EBB03E38A53ED3E%21116&authkey=AC4lDqtLG8LqfiA.
Feed it to
wgetusing following syntax:
wget --no-check-certificate "https://onedrive.live.com/download?cid=6EBB03E38A53ED3E&resid=6EBB03E38A53ED3E%21116&authkey=AC4lDqtLG8LqfiA"
Using Chrome (but Firefox will probably also work).
- Open DevTools
- Click the Download button.
- Download but cancel immediately
- Open the 'Network' tab in DevTools. Search for 'Zip?authKey=' in DevTools and open it (click). This is a POST request.
- Click 'View source' to the right of 'Form data' at the bottom.
- Construct the command as follows:
wget --post-data='<raw form data>' '<Download URL>'
wget --post-data='resIds=xxx&canary=yyy&authkey=zzz' 'https://cid--foobar.users.storage.live.com/downloadfiles/V1/Zip?authKey=zzz'
This even works on a different host (with a different IP address).
This python SDK (with example) for OneDrive project works (for personal, business, and corporate accounts):
Also, we can use CurlWget I already tried on OneDrive and Google Drive
generate a download link and append "&download=1" to the end of it.
e.g. if the link is "https://some.host/:z:/x/personal/some_user/123456asdf?e=12345"