如何从网站的 URL 获取网站的缩略图?
我想通过输入网址来保存网站的缩略图,例如,如果我输入 http://www.google.com< /a> ,它应该生成谷歌搜索页面的缩略图。
到目前为止我一直在使用的一个这样的 API 是 http://counter2.goingup.com/thumboo/image.php。 示例网址:
但是,晚了它显示错误“找不到网址”。有人知道这个 API 究竟出了什么问题吗?
还有其他这样方便的第三方 API 可以对我有一些帮助吗?我所说的方便,是指每次在数据库中找不到该网站的任何预先存在的快照时,它不应该显示蹩脚的屏幕截图排队消息。
I want to save the thumbnails of a website by just entering their urls , e.g if I enter http://www.google.com , it should generate the thumbnail of the google search page .
One such API that I was using till now is http://counter2.goingup.com/thumboo/image.php.
A sample url for that :
But , off late it's showing the error "URL not found" . Do anybody know what exacly has gone wrong with this API ?
Is there any other such convenient third party API out there which can be of some help to me . By convenient , I mean, it should not show a lame Screenshot queued up message everytime it fails to find any pre-existent snapshot for that website in their db.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 PhantomJS 创建屏幕截图。 PhantomJS 附带了一个名为
rasterize.js
的示例,它正是这样做的。示例:文档此处。相关项目,包括网络服务此处。
Use PhantomJS to create screenshots. PhantomJS comes with an example called
rasterize.js
, which does exactly this. Example:Docs here. Related projects including web services here.
http://snapit.io 效果很好,可以为您提供 CDN 上的历史缓存。例如,此 URL 看起来像
http://www.snapit.io/snaps?url=https://stackoverflow.com/questions/7907170/get-thumbnails-of-a-website-from-their-urls
如果您想要 200x200 像素的缩略图(保持纵横比),你可以这样做
http://www.snapit.io/snaps?url=https://stackoverflow.com/questions/7907170/get-thumbnails-of-a-website-from-their-urls&max_width=200&max_height =200
还有很多类似的其他服务,但大多数都需要订阅才能进行大量使用(包括snapit.io), http://url2png.com, http://www.shrinktheweb.com, http://www.thumbalizr.com。
http://snapit.io works well, and gives you historical caching on a CDN. For example this URL would look like
http://www.snapit.io/snaps?url=https://stackoverflow.com/questions/7907170/get-thumbnails-of-a-website-from-their-urls
if you wanted a thumbnail of 200x200 pixels (keeping aspect ratio) you could do
http://www.snapit.io/snaps?url=https://stackoverflow.com/questions/7907170/get-thumbnails-of-a-website-from-their-urls&max_width=200&max_height=200
There's a lot of other services just like this out there, most require a subscription for any substantial amount of use though (including snapit.io), http://url2png.com, http://www.shrinktheweb.com, http://www.thumbalizr.com.