OneDrive
OneDrive使用wget下载会出现403 forbidden,可通过下面方法下载。
浏览器右键进入检查界面,选择netowork,搜索download.aspx,然后在待下载文件处点击下载,即可出现下载链接,复制为cURL即可下载。
curl 'https://maildluteducn-my.sharepoint.com/personal/yan_bin_mail_dlut_edu_cn/_layouts/15/download.aspx?UniqueId=4fa09043%2D6cc3%2D40fb%2Db33e%2Da6f8d46d9bc4' \
# 这里删除了自己浏览器的参数,直接使用复制后的即可
--output model.pth # 指定下载文件名
Google Drive
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
以这个文件为例https://drive.google.com/file/d/1nJXhoEcy3KTExr17I7BXqY5Y9Lx_-n-9/view
将上面命令行中的FILEID替换为1nJXhoEcy3KTExr17I7BXqY5Y9Lx_-n-9,FILENAME 替换下载文件的路径及文件名即可,如cc_sbu_align.zip。
那么实际的下载命令如下:
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1nJXhoEcy3KTExr17I7BXqY5Y9Lx_-n-9' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1nJXhoEcy3KTExr17I7BXqY5Y9Lx_-n-9" -O cc_sbu_align.zip && rm -rf /tmp/cookies.txt
参考文献:知乎