1

在此处输入图像描述

当我尝试使用 wget 下载时,此图像已损坏。我完全不确定我哪里出错了。这是我的代码:

command = 'wget '  + '-U "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.654.0 Chrome/11.0.654.0 Safari/534.17"'  + image + ' -O ' + path

                ssh.exec_command(command)
                command = 'mogrify -auto-orient ' + path
                ssh.exec_command(command)
4

1 回答 1

0

先验你正在做正确-U的浏览器和代理字符串。

这对这里的提问者有用:

wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.17 
(KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.654.0 Chrome/11.0.654.0 
Safari/534.17" http://static.die.net/earth/mercator/1600.jpg

因此,您可以确保粘贴代码中的+ image + ' -O ' + path内容实际上是 url 形式的http://static.die.net/earth/mercator/1600.jpg

于 2013-05-14T15:26:50.673 回答