Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get thumbnails of a website from their urls

Tags:

url

screenshot

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 :

http://counter2.goingup.com/thumboo/image.php?i=1f899e4e1abf9473ccae69de4f3ec1ca|||www.google.com|||80x50

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.

like image 834
deGee Avatar asked Oct 26 '11 18:10

deGee


2 Answers

Use PhantomJS to create screenshots. PhantomJS comes with an example called rasterize.js, which does exactly this. Example:

phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png

Docs here. Related projects including web services here.

like image 57
Jabba Avatar answered Sep 21 '22 18:09

Jabba


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.

like image 45
Jason N Avatar answered Sep 19 '22 18:09

Jason N