Mar*_*zei 4 unix curl wget onedrive
我需要使用 WGET 或 CURL 将 Excel 电子表格从 Onedrive 共享位置下载到我们的 unix 服务器。我可以毫无问题地下载不受保护的链接:
wget "https://...&download=1"
Run Code Online (Sandbox Code Playgroud)
但我希望通过密码或仅允许我们公司的人员访问来保护该文件。
问题是,我无法使用 WGET 下载此类受保护的文件,不接受 --password 选项:
wget --password=abc "https://...&download=1"
Run Code Online (Sandbox Code Playgroud)
Sus*_*wal 10
Google Chrome 和 Mozilla Firerfox 都提供了专门为 cURL 复制下载链接的选项。此选项将生成 cURL 以及所有必需的内容,例如用于从侧面下载内容的用户代理。为了得到这个,
\n--output file.extension将内容保存在file.extension中,因为终端无法显示二进制数据。该命令的示例:
\n curl \'https://company-my.sharepoint.com/personal/path/_layouts/15/download.aspx?SourceUrl=\n %2Fpersonal%2Fsome%5Fpath%5Fin%2Ffile\' -H \'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux \n x86_64; rv:73.0) Gecko/20100101 Firefox/73.0\' -H \'Accept: text/html,application/xhtml+xml,\n application/xml;q=0.9,image/webp,*/*;q=0.8\' -H \'Accept-Language: en-US,en;q=0.5\' \n --compressed -H \'DNT: 1\' -H \'Connection: keep-alive\' -H \'Referer: https://company-my\n .sharepoint.com/personal/path/_layouts/15/onedrive.aspx?id=%2Fpersonal%2Fagain%5Fa%5Fpath%2F\n file&parent=%2Fpersonal%2Fpath%5Fagain%5Fin%2&originalPath=somegibberishpath\' -H \n \'Cookie: MicrosoftApplicationsTelemetryDeviceId=someid; \n MicrosoftApplicationsTelemetryFirstLaunchTime=somevalue; \n rtFa=rootFederationAuthenticationCookie; FedAuth=againACookie; CCSInfo=gibberishText; \n FeatureOverrides_enableFeatures=; FeatureOverrides_disableFeatures=\' -H \n \'Upgrade-Insecure-Requests: 1\' -H \'If-None-Match: "{some value},2"\' -H \'TE: Trailers\' \n --output file.extension\nRun Code Online (Sandbox Code Playgroud)\n从Kulfy 在wget 或 curl 中的回答中,从 OneDrive for Business 下载文件时给出 403:Forbidden
\n进一步阅读:为什么curl 和wget 会导致403 禁止?
\n