How can I get a preview from the URL page on Android?

I am creating an application to store some URLs and I want to display a preview preview next to the page title in the list.

I saw something similar on Whatsapp, when I put the URL (for example: http://www.google.com ), this application receives a thumbnail preview and places it next to the link.

So how can I do this and put this finger on my list?

+5
source share
2 answers

It’s best to use the API to create thumb images from a URL ... check LINK ... find it free if you want ...

example: from HERE

https://api.thumbalizr.com/?url=http://www.facebook.com https://api.thumbalizr.com/?url=http://www.google.com 
0
source

Looking for it for a few hours, I found a solution that works, but I think this may not be the easiest way.

Solution: Download the page URL to a temporary file on the device. Read the temporary file and try to find some regular expressions describing the thumb of this page. Download the thumb with the link found earlier and delete the temporary file.

The samples I'm looking for are as follows:

 <meta property="og:image" content="http://link_for_the_thumb" /> <meta content="http://link_for_the_thumb" itemprop="image"> <link rel="image_src" href="http://link_for_the_thumb"> 

I think there is a much better way to do this, but that's exactly how I found it. Waiting for ideas.

thanks

0
source

Source: https://habr.com/ru/post/1245996/


All Articles