有没有一种方法可以通过URL自动抓取网站的截图?

时间:2022-07-11 19:18:29

I am trying to find a PHP script (or a script in a different language) that after passing a URL, it takes a screenshot of the website for that URL. So for example if I pass *.com, it should take a screen shot of the website (in this case the homepage), keep it on the server, and provide a link to that pic.

我正在尝试找到一个PHP脚本(或另一种语言的脚本),在传递一个URL之后,它会对该URL的网站截图。例如,如果我通过*.com,它应该在网站的屏幕截图(在本例中是主页),将它保存在服务器上,并提供该图片的链接。

Is there an easy way to do that?

有简单的方法吗?

I know it is possible because that's how they take thumbnails for websites in Alexa for example.

我知道这是可能的,因为这是他们在Alexa网站的缩略图。

If you need more explanation of what I mean please just post a comment and I will explain more.

如果你需要更多的解释,请发表评论,我会解释更多。

Thank you :)

谢谢你:)

6 个解决方案

#1


1  

Here is a similar question:

这里有一个类似的问题:

Also try www.thumbshots.com.

也试试www.thumbshots.com。

#2


0  

Start a Browser (like system("firefox [url]")), run a screengrabber for that window and save the image somewhere.

启动一个浏览器(比如系统(“firefox [url]”)),运行一个屏幕抓取器,将图像保存在某个地方。

Since the output is always depending on the render engine used it is not possible by using php alone.

由于输出总是依赖于使用的呈现引擎,因此仅使用php是不可能的。

Other option would be to embed a rendering engine (Gecko or similar) into your php script.

另一种选择是在php脚本中嵌入一个呈现引擎(Gecko或类似的)。

#3


-1  

You can use browsershots.org service or litmusapp.com. Both of these will generate screenshot of a page. You can then download the screenshot and use it in a way you need to.

您可以使用browsershots.org服务或litmusapp.com。这两个都将生成页面的屏幕截图。然后,您可以下载截图,并以您需要的方式使用它。

#4


-1  

Something like Litmus?

像石蕊吗?

#5


-1  

Browsershots normally has their backend source code available, but as of this answer, it appears to be offline at the moment. There is an outdated mirror on Github which you can look at.

Browsershots通常有他们的后端源代码可用,但是在这个结果中,它看起来是离线的。Github上有一面过时的镜子,你可以看到它。

#6


-1  

Google page speed insight Api provide thumbnail size screenshot,

谷歌页面速度洞察Api提供缩略图尺寸截图,

I have coded example here (for PHP),

我在这里编写了示例(PHP),

https://github.com/harshadgoswami/site-screenshot

https://github.com/harshadgoswami/site-screenshot

hope it helps

希望它能帮助

#1


1  

Here is a similar question:

这里有一个类似的问题:

Also try www.thumbshots.com.

也试试www.thumbshots.com。

#2


0  

Start a Browser (like system("firefox [url]")), run a screengrabber for that window and save the image somewhere.

启动一个浏览器(比如系统(“firefox [url]”)),运行一个屏幕抓取器,将图像保存在某个地方。

Since the output is always depending on the render engine used it is not possible by using php alone.

由于输出总是依赖于使用的呈现引擎,因此仅使用php是不可能的。

Other option would be to embed a rendering engine (Gecko or similar) into your php script.

另一种选择是在php脚本中嵌入一个呈现引擎(Gecko或类似的)。

#3


-1  

You can use browsershots.org service or litmusapp.com. Both of these will generate screenshot of a page. You can then download the screenshot and use it in a way you need to.

您可以使用browsershots.org服务或litmusapp.com。这两个都将生成页面的屏幕截图。然后,您可以下载截图,并以您需要的方式使用它。

#4


-1  

Something like Litmus?

像石蕊吗?

#5


-1  

Browsershots normally has their backend source code available, but as of this answer, it appears to be offline at the moment. There is an outdated mirror on Github which you can look at.

Browsershots通常有他们的后端源代码可用,但是在这个结果中,它看起来是离线的。Github上有一面过时的镜子,你可以看到它。

#6


-1  

Google page speed insight Api provide thumbnail size screenshot,

谷歌页面速度洞察Api提供缩略图尺寸截图,

I have coded example here (for PHP),

我在这里编写了示例(PHP),

https://github.com/harshadgoswami/site-screenshot

https://github.com/harshadgoswami/site-screenshot

hope it helps

希望它能帮助