Edward Linus's personal blog, focusing on coding and etc.

Currently working method to get direct download link from OneDrive share link

C

0x00 Introduction

Microsoft OneDrive has long been a indispensable cloud service for me to store PPTs, PDFs, etc. Its user experience are marvelous, the sync, upload and download speed are satisfying, but what bothers me is that it takes me a long time to fully load a OneDrive file share page, as a result, I seldom use OneDrive to share files with my friends.

0x01 Methods

It is quite simple to obtain direct download link for personal OneDrive link like

Just replace the “1drv.ms” with “1drv.ws“, the new link is what we want.In this case, the direct download link should be:

As for personal OneDrive link after redirection like

We need to obtain two credentials in the query string, which is “resid” and “authkey “, in this case, they are “DECC1996A5477873!723” and “!AqWkl_GohQTI94Y” respectively. After gathering the credentials, the direct link can be generated like following form:

In this case, the direct download link should be:

Then the Office 365 OneDrive link like:

We also need to extract three credentials in the link, which is “domain“, “resid” and “user_info“, in this case, they are “https://xxx-my.sharepoint.com“, “blah-blah” and “xx_xxx_onmicrosoft_com” respectively. After getting the credentials, the direct download link can be generated by following pattern:

In this case, the direct download link should be:

0x02 Code example

The following code is a example Java code to show you how to generate a OneDrive direct link from OneDrive share link.

Its new update can be found on https://github.com/Xiderowg/OneDriveDirectLinkHelper

About the author

EDLinus

[stay(d) for d in ('determined','diligent','devoted')]

1 Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By EDLinus
Edward Linus's personal blog, focusing on coding and etc.

Meta