[英]Powershell - Invoke-Webrequest (Error 503 when run via script)
I have a script that parses a website for download links to TV shows I follow, copies the links of any new episodes, at which point J-Downloader takes over. 我有一个脚本,用于解析网站以下载指向我关注的电视节目的链接,并复制任何新剧集的链接,此时J-Downloader会接管。
The script was working fine up until a few days ago when, apparently this website implemented some sort of browser authentication. 直到几天前该脚本一直运行良好,当时该网站显然实现了某种浏览器身份验证。
Invoke-WebRequest
is returning the following: Invoke-WebRequest
返回以下内容:
Invoke-WebRequest : The remote server returned an error: (503) Server Unavailable.
Invoke-WebRequest:远程服务器返回错误:(503)服务器不可用。
The website is rapidmoviez.com. 该网站是Rapidmoviez.com。 Either this base website or a specific show website (eg www.rapidmoviez.com/the-walking-dead) returns blank
$links
when run through the script. 当运行脚本时,此基本网站或特定的表演网站(例如www.rapidmoviez.com/the-walking-dead)都将返回空白的
$links
。
$links = invoke-webrequest -Uri "www.rapidmoviez.com/the-walking-dead"
$links = $links.Links
The website loads fine within a browser but comes up to a "Checking your browser before accessing Rapidmoviez" screen if I clear my cache. 该网站可以在浏览器中正常加载,但是如果我清除了缓存,就会出现“在访问Rapidmoviez之前检查浏览器”屏幕。
I tried specifying the useragent header as suggested elsewhere but that yielded the same results. 我尝试按照其他地方的建议指定useragent标头,但结果相同。
$userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"
$test = Invoke-WebRequest 'www.rapidmoviez.com' -Headers @{"User-Agent"=$useragent} -Method Get
Really appreciate any assistance!! 非常感谢任何帮助!
Problem is not with your code but with your connection. 问题不在于您的代码,而在于您的连接。 I just run these same command and got the results just fine:
我只是运行这些命令,并得到了很好的结果:
PS> $links.count
3269
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.