vps交流

curl获取OneDrive分享链接的cookie用来下载直链


本帖最后由 好鸭 于 2022-5-17 17:06 编辑

  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://mianmail-my.sharepoint.com/personal/larry01_mianmail_onmicrosoft_com/_layouts/15/guestaccess.aspx?folderid=0409c294f842a45efbf1fca0edeae1a81&authkey=AQNtcjUo9YH1oFShAnHapgU&e=ph0MUw" -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: //’`"
  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:05 编辑

这样也行啊,曲奇有效期一般多久?

直接直连不好吗
zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《curl获取OneDrive分享链接的cookie用来下载直链》
文章链接:https://bbs.moe.am/118570.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
Telegram交流群:加入聊天

相关推荐