Coder Social home page Coder Social logo

获取OneDrive直链

本应用的目的是为了批量获取 OneDrive 直链,方便在其他站点外链。前身为提取OneDrive直链地址工具的网页版,因为原来的工具失效了,软件版也不是那么好用了,因此决定使用 OneDrive 官方 SDK 来进行获取,确保不失效。

马上使用

https://mapaler.github.io/GetOneDriveDirectLink/

因为使用官方 API 直接访问 onedrive.live.com 选择文件,因此可能需要翻墙。

隐私声明

使用微软官方 OneDrive file picker SDK,本应用不会得到你的账号密码和其他用户资料。 目前仅申请了 Files.ReadFiles.Read.Selected 两个权限,SDK 只会返回用户选择的文件的信息,不会获得未授权的其他内容。

如何自行搭建

按照OneDrive file picker SDK内的说明进行,由于旧有的Microsoft 应用注册门户已经迁移到Azure门户,特此做出更新,此版本更新于2020年2月6日。

  1. 应用注册
    Azure 门户 创建应用,自己申请一个应用 ID,然后替换本程序 script.js 内底部的 clientId
    客户端ID
    其中 odOptions.advanced.queryParameters 内容参见 DriveItem 资源类型,若不设定,将只返回基本信息。
  2. 设置身份验证
    将网页的各种东西上传到你申请 ID 时设置的 重定向 URL 即可,页面 URL 不在重定向内会发生错误。注:这个页面必须为 https(仅 localhost 可为 http,且 localhost 也需添加到 重定向 URL)
    需要勾选隐式授权访问令牌ID 令牌讨论见#9 身份验证
  3. 设置API 权限
    添加 Microsoft Graph委托的权限Files.ReadFiles.Read.Selected
    需求的权限

原理

http://storage.live.com/items/文件ID 是很早之前就流传的 SkyDrive 官方的真实直链重定向地址,出处不可考。
开始一般是用http://storage.live.com/items/文件ID?filename=xxx.jpg来外链图片,后面的文件名用来欺骗DiscuzX论坛系统,但是浏览器下载该文件还是没有正确文件名。
后来有高手发现的http://storage.live.com/items/文件ID:/xxx.jpg这个地址格式不会影响 SkyDrive 识别ID,还同时可以欺骗浏览器为普通文件地址,识别出文件的文件名与扩展名。
访问 onedrive.live.com 域名需要翻墙,但是生成的 storage.live.com 链接不需要。

1drv.ws 原理

1drv.wsThe OneDrive Direct Download Link Helper 项目的实现。
原理为

  1. 获取OneDrive的分享链接 https://1drv.ms/u/分享ID
  2. 重定向到 https://onedrive.live.com/redir?resid=文件ID&authkey=通行证
  3. 将访问网页的地址修改为下载地址 https://onedrive.live.com/download?resid=文件ID&authkey=通行证
  4. 再次重定向到真实CDN地址 https://public.ch.files.1drv.com/很长一串字符/文件名?download&psid=1

其中,对 onedrive.live.com 的重定向需要墙外后端支持。

在 OneDrive SDK 中,使用 share 操作才能新增并获取到分享链接,因此添加了“额外创建分享链接”按钮。
掩码将获取到的分享链接中的 1drv.ms 修改为 1drv.ws ,即可得到下载链接。但是这种方式的 http header content-Dispositong 值为 attachemen 会弹出下载窗口,而不是内部预览。

a52948's Projects

alist icon alist

🗂️A file list program that supports multiple storage, powered by Gin and React. / 一个支持多存储的文件列表程序,使用 Gin 和 React 。

bp3 icon bp3

bp3是一款使用php开发的百度网盘接口程序,百度网盘目录搜索引擎,文件展示搜索目录树,在线目录搜索索引,百度网盘文件下载(含直链)等。

cfwarp icon cfwarp

Cloudflare WARP 多功能一键脚本,(自动识别WGCF与SOCKS5环境,同步循环Endpoint的IP,1:自定义设置刷新奈飞IP、自定义设置奈飞的IP区域,2:自定义设置仅刷IP区域,3:自定义WARP的IP段),支持升级WARP+及Teams账户。已测试:hax纯v6站,Euserv(德鸡),oracle(甲骨文云)等…………功能更新增加中…

cloudreve icon cloudreve

🌩支持多家云存储的云盘系统 (A project helps you build your own cloud in minutes)

clover-efi icon clover-efi

分享整理一些黑苹果Clover驱动配置文件

discount-for-student-dev icon discount-for-student-dev

This is list of discounts on software (SaaS, PaaS, IaaS, etc.) and other offerings for developers who are students

express-hello-world icon express-hello-world

Implements the Expressjs Hello World example to provide a faster start deploying on the Cyclic platform

free-for-dev icon free-for-dev

A list of SaaS, PaaS and IaaS offerings that have free tiers of interest to devops and infradev

freenom icon freenom

Freenom域名自动续期。Freenom domain name renews automatically.

gh-proxy icon gh-proxy

github release、archive以及项目文件的加速项目

go-proxy-bingai icon go-proxy-bingai

用 Vue3 和 Go 搭建的微软 New Bing 演示站点,拥有一致的 UI 体验,支持 ChatGPT 提示词,支持 API 调用,国内可用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.