Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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": ""
      }
    }
like image 919
Kartik Shandilya Avatar asked Mar 05 '17 14:03

Kartik Shandilya


1 Answers

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)

like image 100
Prayag Verma Avatar answered Oct 01 '22 11:10

Prayag Verma