Skip to content

Instantly share code, notes, and snippets.

@cdeitrick
Created March 16, 2024 21:10
Show Gist options
  • Select an option

  • Save cdeitrick/b5ce1dc9b78516694942b79e440023ff to your computer and use it in GitHub Desktop.

Select an option

Save cdeitrick/b5ce1dc9b78516694942b79e440023ff to your computer and use it in GitHub Desktop.
Download OneDrive files in terminal
Google Chrome as well as Mozilla Firerfox both provide an option to copy download link specifically for cURL. This option will generate cURL with all required things such as User agent for downloading things from the side. To get that,
1. Open the URL in either of the browser.
2. Open Developer options using Ctrl+Shift+I.
3. Go to Network tab.
4. Now click on download. Saving file isn't required. We only need the network activity while browser requests the file from the server.
5. A new entry will appear which would look like "download.aspx?...".
6. Right click on that and Copy → Copy as cURL.
7. Paste the copied content directly in the terminal and append --output file.extension to save the content in file.extension since terminal isn't capable of showing binary data.
@sparks-gen
Copy link

I forked and made some minor edits, in case you are interested in incorporating them

@schyen
Copy link

schyen commented Nov 3, 2025

thanks for this! it was super helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment