开发者

how to get instant thumbnail and description of a random page

开发者 https://www.devze.com 2023-03-12 17:43 出处:网络
i know there are other questions that ask for something similar, but those questions ask for a specific product that do so....I\'m asking for a high level strategy of how to tackle this task so that I

i know there are other questions that ask for something similar, but those questions ask for a specific product that do so....I'm asking for a high level strategy of how to tackle this task so that I can write the script myself

it would be preferable to accomplish this in PHP/Javascript

my goal is to get a thumbnail of a page using the most appropriate images that are shown in the page ...I also need to obtain an appropriate description even when there is no description meta tag...if there's no description meta tag, then the script should obtain some text from the page itself that is most appropriate to be used as description......it's similar to how facebook does it

If you look at this: http://www.freakonomics.com/2008/09/24/wall-street-jokes-please/

and view the source, the site has no og:image tag to tell facebook which image to use, nor does it have a description meta tag

yet if you "share" it in facebook, facebook automatically chooses the most appropriate image from the page to use as a thumbnail and it also obtains an appropriate description using the text that appears from the main page...

how exactly do they accomplish this, or how should I go about doing something similar to this in general using PHP/Javascript? how do I distinguish between appropriate text/image for the description/thu开发者_StackOverflow社区mbnail of the page vs pure noise (ads, links, buttons, banners, etc)?


I assume they are looking for all <img src that are on the same domain of the site that match a certain width/height. When a site doesn't have the fb tags and it has to guess, it allows you to choose between a few thumbnails to select the most appropriate one.

The problem with this is that it probably takes up a huge amount of processing power that has to be done on the fly. Speed and scalability would become a factor unless you were a company like facebook who have the power and technology.

That said it's certainly possible to do, take a look at a similar question I posed a while back.


Check this website out http://imagevat.com/muupload.php is this what you mean?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号