How major websites capture thumbnails from a link?

狂风中的少年 提交于 2019-12-04 10:16:44

They typcailly look for an image on the page, and scale it down on their servers. Reddit's scraper code shows a good deal of what they do. The Scraper class should give you some good ideas on how to tackle this.

JohnD's answer shows that Reddit uses embed.ly as part of their Python solution. Really embed.ly does the hard part of finding the image and they're free under 10,000 requests/mo.

They generally use a tool like webkit2png.

Some use

 <link rel="image_src" href="yourimage.jpg" /> 

included in the head of the page. See http://www.labnol.org/internet/design/set-thumbnail-images-for-web-pages/6482/

Facebook uses

<meta property="og:image" content="thumbnail_image" />

see: http://developers.facebook.com/docs/share/#basic-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!