如何从一直打电话的网站上保存图片?

时间:2017-09-09 01:33:56

标签: html shell sockets

我想保存显示在此地址的图片:http://yunogo.miemasu.net/nphMotionJpeg?resolution=640x480。 以下是该页面的源代码:

<html>
<head>
     <title>nphMotionJpeg 640×480 pixels</title>
</head>
<body style="margin: 0px">
    <img style="-webkit-user-select:none; display:block; margin:auto;" src="http://yunogo.miemasu.net/nphMotionJpeg?resolution=640x480">
</body>
</html>

请注意,问题是图像对象调用自身进行更新,因此我使用它的脚本或语言会卡在接收来自上述URL的对象的行上。 我已经尝试过webkit2png,wget,urllib,但它们没有被证明有用。

可能的想法:

编写一个高级脚本,在浏览器中打开链接,最大化它,拍摄屏幕快照,用图像裁剪区域,保存。

编写一个脚本来调用它之间的页面,从缓存中获取临时对象。

注意:目标是从页面获取图像,它可以是任何语言。

1 个答案:

答案 0 :(得分:1)

您可以使用ffmpeg

ffmpeg -i "http://yunogo.miemasu.net/nphMotionJpeg?resolution=640x480" out_%03d.jpg

在这种情况下,out_%03d.jpg会将图像保存为:

out_001.jpg
out_002.jpg
out_003.jpg
...

只获得一张照片,single frame

ffmpeg -i "http://yunogo.miemasu.net/nphMotionJpeg?resolution=640x480" -vframes 1 out.jpg

您可以通过定义-f mjpeg来强制输入,但通常会自动检测格式:

ffmpeg -f mjpeg -i "http://yunogo.miemasu.net/nphMotionJpeg?resolution=640x480" -vframes 1 out.jpg