全球主机交流论坛

标题: curl获取OneDrive分享链接的cookie用来下载直链 [打印本页]

作者: 好鸭    时间: 2022-5-17 17:02
标题: curl获取OneDrive分享链接的cookie用来下载直链
本帖最后由 好鸭 于 2022-6-15 11:42 编辑
  1. curl -L "https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx" \
  2. -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36" -s -I|grep set-cookie|grep FedAuth
复制代码



链接改成分享链接(不然很可能获取不到cookie,重复提一次,是分享链接


适合在那种一个分享链接里文件特别多的,获取了直链配合脚本来用


比如那个暴力猴脚本https://github.com/kaaass/sharepoint-list-plugin


复制了很多链接后


wget -x可以保留目录结构

  1. echo -e "https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/1.mp4
  2. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/2.mp4
  3. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/3.mp4
  4. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/4.mp4"|while read url;do

  5. cookie="$(curl -L 'https://xxxxx-my.sharepoint.com/:f:/g/personal/xxxxx_xxxxx_onmicrosoft_com/xxxxxxxx' -A 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36' -s -I|grep set-cookie|grep FedAuth|sed 's/set-cookie: //'|sed 's/;.*//')"

  6. wget --header "cookie: $cookie" -x "$url"

  7. done
复制代码


如果文件不是特别多,一两个小时可以下完的,直接写死cookie就行了(脚本里获取是怕cookie过期)
  1. echo -e "https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/1.mp4
  2. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/2.mp4
  3. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/3.mp4
  4. https://https://xxxx-my.sharepoint.com/personal/xxxxxxxxxxxxxxxxxx/4.mp4"|while read url;do

  5. cookie='FedAuth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;'

  6. wget --header "cookie: $cookie" -x "$url"

  7. done
复制代码

作者: zxxx    时间: 2022-5-17 17:04
本帖最后由 zxxx 于 2022-5-17 17:05 编辑

这样也行啊,曲奇有效期一般多久?
作者: CMBCHINA    时间: 2022-5-17 17:24
直接直连不好吗
zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso
作者: 好鸭    时间: 2022-5-17 18:13
CMBCHINA 发表于 2022-5-17 17:24
直接直连不好吗
zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso

自己的盘才能这样用吧,能挂载别人的分享链接吗?
作者: xepo    时间: 2022-6-15 13:12
下载别人的链接用脚本
https://greasyfork.org/zh-CN/scripts/432415
作者: 好鸭    时间: 2022-6-15 13:15
xepo 发表于 2022-6-15 13:12
下载别人的链接用脚本
https://greasyfork.org/zh-CN/scripts/432415

这不就帖子里说到的那个吗
作者: 逸笙    时间: 2022-6-15 13:51
OneManager跟onepoint里面就有拿这个共享链接来列表的。
作者: thaizxj    时间: 2022-6-15 13:54
逸笙 发表于 2022-6-15 13:51
OneManager跟onepoint里面就有拿这个共享链接来列表的。

蘑菇大佬
作者: 好鸭    时间: 2022-6-15 13:55
逸笙 发表于 2022-6-15 13:51
OneManager跟onepoint里面就有拿这个共享链接来列表的。

这个好,改天试试
作者: oooo    时间: 2022-6-15 13:56
mm
作者: deeprobe    时间: 2022-6-22 12:52
有访问密码的怎么搞?
作者: nebulabox    时间: 2022-6-22 12:53
对分享表示很赞!

也可以试试rclone
作者: 好鸭    时间: 2022-6-22 12:55
nebulabox 发表于 2022-6-22 12:53
对分享表示很赞!

也可以试试rclone

rclone又不能下载别人的分享链接,不然就不用这么麻烦了




欢迎光临 全球主机交流论坛 (https://loc.imgfree.eu.org/) Powered by Discuz! X3.4