invoke-webrequest to get complete web page with images

你说的曾经没有我的故事 提交于 2019-12-08 06:45:00

问题


How do I get the output file to contain the images on the webpage and not just the links to the images?

PS C:\temp> Invoke-WebRequest http://mitpress.mit.edu/sites/default/files/titles/content/sicm/book-Z-H-51.html -OutFile C:\temp\51.html


回答1:


You need to explore the page a bit to figure out some of details. Here's a complete script which I've tested successfully.

Invoke-WebRequest http://mitpress.mit.edu/sites/default/files/titles/content/sicm/book-Z-H-51.html |
select -expand images |
select -expand src |
foreach { start-bitstransfer $("http://mitpress.mit.edu/sites/default/files/titles/content/sicm/{0}" -f $_) C:\Users\Public\Downloads}


来源:https://stackoverflow.com/questions/14054030/invoke-webrequest-to-get-complete-web-page-with-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!