'Thumbnail of Blogger Post URL using Blogger API

I have an app that uses Blogger API to show the posts of a blog in a listview. Is there a way in which I can extract the thumbnail of the corresponding post URL? This is general JSON response we get-

{


"kind": "blogger#blog",
      "id": "2399953",
      "name": "Blogger Buzz",
      "description": "The Official Buzz from Blogger at Google",
      "published": "2007-04-23T22:17:29.261Z",
      "updated": "2011-08-02T06:01:15.941Z",
      "url": "http://buzz.blogger.com/",
      "selfLink": "https://www.googleapis.com/blogger/v3/blogs/2399953",
      "posts": {
        "totalItems": 494,
        "selfLink": "https://www.googleapis.com/blogger/v3/blogs/2399953/posts"
      },
      "pages": {
        "totalItems": 2,
        "selfLink": "https://www.googleapis.com/blogger/v3/blogs/2399953/pages"
      },
      "locale": {
        "language": "en",
        "country": "",
        "variant": ""
      }
    }


Solution 1:[1]

According to the documentation, If you query the endpoint for post list via -

https://www.googleapis.com/blogger/v3/blogs/blogId/posts

It should return a Post resource, from which you can access the images property to get the image URL for the individual posts.

But, currently the Blogger API doesn't return the images property when you call the post list or even the individual post endpoint (via - https://www.googleapis.com/blogger/v3/blogs/blogId/posts/postId). Therefore, you have two alternatives available -

  1. Either parse the HTML from the content property and find the Image URL from there.

  2. Or query the publicly available API for post list (via - https://www.blogger.com/feeds/blogID/posts/default?alt=json and get the image URL via the media$thumbnail property)

Solution 2:[2]

In case you're using Google API Client for Java to access the Blogger API v3, you'll have to set true to the fetchImages boolean property of the Blogger.Posts.List object:

// the request action
final Blogger.Posts.List postsListAction = blogger.posts().list(BLOG_ID);

// get post images as well (default: false)
postsListAction.setFetchImages(true);

Solution 3:[3]

Try following 2 parameters for list page.

 fetchBodies=false
 fetchImages=true

I wish they had also added an overview flag in request, Something which decide to return few line of readable content from post.
Right now whole markup is returned.

if you want to show post overview also along with image and title then you need to manipulate the content value by javascript to extract first few line of readable content.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Prayag Verma
Solution 2 panagiotis
Solution 3 ThrowableException