Direct download link to OneDrive file?

后端 未结 2 1535
时光取名叫无心
时光取名叫无心 2021-02-08 11:40

A OneDrive sharable link looks like this: https://1drv.ms/w/s!AqmFiI7maXrRgT7PGcK_7JyZlBco. How do I get the direct download link version of this? I know with a onedrive.live/re

相关标签:
2条回答
  • 2021-02-08 12:08

    You can also add a simple function to your .bashrc that will do the same trick:

    onelink() { echo -n "$1"|base64|sed "s/=$//;s/\//\_/g;s/\+/\-/g;s/^/https:\/\/api\.onedrive\.com\/v1\.0\/shares\/u\!/;s/$/\/root\/content/"; }
    

    Result is the same:

    $ onelink 'https://1drv.ms/w/s!AqmFiI7maXrRgT7PGcK_7JyZlBco'
    https://api.onedrive.com/v1.0/shares/u!aHR0cHM6Ly8xZHJ2Lm1zL3cvcyFBcW1GaUk3bWFYclJnVDdQR2NLXzdKeVpsQmNv/root/content
    
    0 讨论(0)
  • 2021-02-08 12:11

    If you follow the instruction here you can generate a URL that will act on the shared item, including being able to get its content.

    In your case the URL would look like https://api.onedrive.com/v1.0/shares/u!aHR0cHM6Ly8xZHJ2Lm1zL3cvcyFBcW1GaUk3bWFYclJnVDdQR2NLXzdKeVpsQmNv/root/content

    0 讨论(0)
提交回复
热议问题