curl下载Respondus LockDown Browser失败但浏览器可正常下载
自动化安装Mac版Respondus LockDown Browser的下载限制问题
我在尝试自动化安装Mac版Respondus LockDown Browser时遇到了服务器端限制:通过GUI网页浏览器可正常下载大小为117.8MB的安装包,但使用curl命令从命令行下载时失败,仅得到5KB文件。我尝试修改User-Agent参数,但问题仍未解决。
相关zsh脚本如下:
#!/bin/zsh # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Download and install Respondus Lockdown Browser from .pkg # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Define Variables installerName="RespondusLockdown" pkgfile="/tmp/$installerName.pkg" url="https://download.respondus.com/lockdown/download7.php?id=228644488&ostype=2" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Define functions checkResult() { error="An error occurred" if [[ $? = 0 ]] then printf "$success" else printf "$error" fi printf "\n\n" } downloadInstaller() { local success="Package downloaded successfully" curl -Lo "${pkgfile}" "${url}" checkResult } installPKG() { local success="Package installed successfully" installer -pkg "$pkgfile" -target / checkResult } cleanUp() { local success="Package removed successfully" rm "$pkgfile" } main() { downloadInstaller installPKG # cleanUp } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # main main exit 0
修改User-Agent的尝试代码:
userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15" curl -A "${userAgent}" -L -o "${pkgfile}" ${url}
内容的提问来源于stack exchange,提问作者user22547243
相关产品推荐
相关产品推荐

