Description
I'm attempting to get all image posts associated with a list blogs (just personal archive reasons), and I'm running into an issue with the Neue Post Format / NPF. If I'm understanding the documentation correctly, NPF should return what's effectively a JSON layout of the post, and NPF posts can be identified by having is_blocks_post_format
as True.
The post I'm having issues with is post id 186412013514. It's marked as a text
type post, NPF, and contains a single image.
The following is the line to find the post as generated by the API console:
client.posts('vagelio', type='photo', limit=1, offset=40, reblog_info=True)
And the response...
{ "meta": { "status": 200, "msg": "OK" }, "response": { "blog": { "ask": true, "ask_anon": true, "ask_page_title": "Ask me anything", "asks_allow_media": true, "avatar": [ { "width": 512, "height": 512, "url": ["https://64.media.tumblr.com/avatar_712957997181_512.png"](https://64.media.tumblr.com/avatar_712957997181_512.png) }, { "width": 128, "height": 128, "url": ["https://64.media.tumblr.com/avatar_712957997181_128.png"](https://64.media.tumblr.com/avatar_712957997181_128.png) }, { "width": 96, "height": 96, "url": ["https://64.media.tumblr.com/avatar_712957997181_96.png"](https://64.media.tumblr.com/avatar_712957997181_96.png) }, { "width": 64, "height": 64, "url": ["https://64.media.tumblr.com/avatar_712957997181_64.png"](https://64.media.tumblr.com/avatar_712957997181_64.png) } ], "can_chat": false, "can_subscribe": false, "description": "Freelancer illustrator\nContact: [email protected]", "is_nsfw": false, "name": "vagelio", "posts": 154, "share_likes": false, "subscribed": false, "theme": { "header_full_width": 938, "header_full_height": 1364, "header_focus_width": 879, "header_focus_height": 495, "avatar_shape": "square", "background_color": "#DCDED4", "body_font": "Helvetica Neue", "header_bounds": "177,879,672,0", "header_image": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s938x1364/93da9b234204a90b33359be4d6a450f39df2da3f.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s938x1364/93da9b234204a90b33359be4d6a450f39df2da3f.jpg), "header_image_focused": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072_c0,12977,93710,49267/9163dcae16537f1de57a42dde0f6e85172e62015.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072_c0,12977,93710,49267/9163dcae16537f1de57a42dde0f6e85172e62015.jpg), "header_image_poster": "", "header_image_scaled": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072/ebce2594714645366b4aa030b5750c66d2ea76df.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072/ebce2594714645366b4aa030b5750c66d2ea76df.jpg), "header_stretch": true, "link_color": "#567080", "show_avatar": true, "show_description": true, "show_header_image": true, "show_title": true, "title_color": "#2E2E2E", "title_font": "Sans Serif", "title_font_weight": "bold" }, "title": "Vagelio", "total_posts": 154, "updated": 1669230150, "url": ["https://vagelio.tumblr.com/"](https://vagelio.tumblr.com/), "uuid": "t:vmv8w8qw3xgtMosxZINm4Q" }, "posts": [ { "type": "text", "is_blocks_post_format": true, "blog_name": "vagelio", "blog": { "name": "vagelio", "title": "Vagelio", "description": "Freelancer illustrator\nContact: [email protected]", "url": ["https://vagelio.tumblr.com/"](https://vagelio.tumblr.com/), "uuid": "t:vmv8w8qw3xgtMosxZINm4Q", "updated": 1669230150, "tumblrmart_accessories": {} }, "id": 186412013514, "id_string": "186412013514", "post_url": ["https://vagelio.tumblr.com/post/186412013514/argam-tiefling-rogue-part-of-a-larger-commission"](https://vagelio.tumblr.com/post/186412013514/argam-tiefling-rogue-part-of-a-larger-commission), "slug": "argam-tiefling-rogue-part-of-a-larger-commission", "date": "2019-07-20 01:32:58 GMT", "timestamp": 1563586378, "state": "published", "format": "html", "reblog_key": "xwQgX7xU", "tags": [ "dungeons and dragons", "rpg", "illustration", "character concept", "dnd", "commission", "fantasy", "dnd character", "character art", "5e", "sketch", "sketchbook", "dnd 5e", "tiefling", "Rogue", "portrait", "commisionwork", "vagelio kaliva", "Vagelio" ], "short_url": ["https://tmblr.co/Z5xoYx2jd1PVA"](https://tmblr.co/Z5xoYx2jd1PVA), "summary": "Argam, tiefling rogue. Part of a larger commission for a kickstarter module.\nFind me on\nTumblr:...", "should_open_in_legacy": false, "recommended_source": null, "recommended_color": null, "note_count": 36, "title": "", "body": "Argam, tiefling rogue. Part of a larger commission for a kickstarter module.
Find me on
Tumblr: http://vagelio.tumblr.com/
Facebook: https://www.facebook.com/vageliokali
Instagram: https://www.instagram.com/vageliokal/
Deviantart: http://vagelio.deviantart.com/
", "reblog": { "comment": "Argam, tiefling rogue. Part of a larger commission for a kickstarter module.
Find me on
Tumblr: http://vagelio.tumblr.com/
Facebook: https://www.facebook.com/vageliokali
Instagram: https://www.instagram.com/vageliokal/
Deviantart: http://vagelio.deviantart.com/
", "tree_html": "" }, "trail": [ { "blog": { "name": "vagelio", "active": true, "theme": { "header_full_width": 938, "header_full_height": 1364, "header_focus_width": 879, "header_focus_height": 495, "avatar_shape": "square", "background_color": "#DCDED4", "body_font": "Helvetica Neue", "header_bounds": "177,879,672,0", "header_image": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s938x1364/93da9b234204a90b33359be4d6a450f39df2da3f.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s938x1364/93da9b234204a90b33359be4d6a450f39df2da3f.jpg), "header_image_focused": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072_c0,12977,93710,49267/9163dcae16537f1de57a42dde0f6e85172e62015.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072_c0,12977,93710,49267/9163dcae16537f1de57a42dde0f6e85172e62015.jpg), "header_image_poster": "", "header_image_scaled": ["https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072/ebce2594714645366b4aa030b5750c66d2ea76df.jpg"](https://64.media.tumblr.com/bc8d9592a2e59aa531c1732d67074363/60aceee2e7f46bf5-9d/s2048x3072/ebce2594714645366b4aa030b5750c66d2ea76df.jpg), "header_stretch": true, "link_color": "#567080", "show_avatar": true, "show_description": true, "show_header_image": true, "show_title": true, "title_color": "#2E2E2E", "title_font": "Sans Serif", "title_font_weight": "bold" }, "share_likes": false, "share_following": false, "can_be_followed": true }, "post": { "id": "186412013514" }, "content_raw": "Argam, tiefling rogue. Part of a larger commission for a kickstarter module.
Find me on
Tumblr: http://vagelio.tumblr.com/
Facebook: https://www.facebook.com/vageliokali
Instagram: https://www.instagram.com/vageliokal/
Deviantart: http://vagelio.deviantart.com/
", "content": "Argam, tiefling rogue. Part of a larger commission for a kickstarter module.
Find me on
Tumblr: http://vagelio.tumblr.com/
Facebook: https://www.facebook.com/vageliokali
Instagram: https://www.instagram.com/vageliokal/
Deviantart: http://vagelio.deviantart.com/
", "is_current_item": true, "is_root_item": true } ], "can_like": false, "interactability_reblog": "everyone", "can_reblog": false, "can_send_in_message": true, "can_reply": false, "display_avatar": true } ], "total_posts": 149, "_links": { "next": { "href": "/v2/blog/vagelio.tumblr.com/posts/photo?type=photo&limit=1&offset=40&reblog_info=true&tumblelog=vagelio.tumblr.com&page_number=VH-0kfNfc0AU9JcdaiZtcKHeFS0_5P3WZdEnabkhmd0zbGM4dW1hN1JKbXdZelpabWZONlU4Y1lNd0xMdWxZR3JFSGpTNWpmUDdZelRxc2RVRjZOOUNabEMybUlQNiszUkVhZ2QyNURCMTNoMHY0RENmbWRIUitKQVpFdFJ3cDhWL2xLOXJLbkhkWm42YVE3SzJtTHJadzNYWkdZQW8rdThFTmUwSm81OEZ2NzZXMTE1K3pBSmVWbWVOVWc4Z3h2T0JZcDIrRFRiQnREMGg5TUhBQjk5QWtYSDZpbk1ITWt0N3EyQWsyeGt5clR5OFVrYXFSTmhzNG1WNC96cHZRdHlMRTJzM1FpUzhTNjNFK01iTjY1L1Z0RDZMU3M4RnhXRk9BSWRGNkhKM3EvN2g1S2g4R1RoYXdrekJ1KzdKT2ZHd0gwZklWOGQ2bzE3ajYvTHdIOW1PRTFJQ2tOWTdkbFlOUXJmU3JqTm5sY21OV1JnUU5LblltRDgzbjFzS2Z2S1h5eHJhRkZyTmtXNzg1RUNYVVk5bS9wR2lhYnBRN2E4ZEFMczVlUzhOZkFQdXB1K2V3elZWZz09", "method": "GET", "query_params": { "type": "photo", "limit": "1", "offset": "40", "reblog_info": "true", "tumblelog": "vagelio.tumblr.com", "page_number": "VH-0kfNfc0AU9JcdaiZtcKHeFS0_5P3WZdEnabkhmd0zbGM4dW1hN1JKbXdZelpabWZONlU4Y1lNd0xMdWxZR3JFSGpTNWpmUDdZelRxc2RVRjZOOUNabEMybUlQNiszUkVhZ2QyNURCMTNoMHY0RENmbWRIUitKQVpFdFJ3cDhWL2xLOXJLbkhkWm42YVE3SzJtTHJadzNYWkdZQW8rdThFTmUwSm81OEZ2NzZXMTE1K3pBSmVWbWVOVWc4Z3h2T0JZcDIrRFRiQnREMGg5TUhBQjk5QWtYSDZpbk1ITWt0N3EyQWsyeGt5clR5OFVrYXFSTmhzNG1WNC96cHZRdHlMRTJzM1FpUzhTNjNFK01iTjY1L1Z0RDZMU3M4RnhXRk9BSWRGNkhKM3EvN2g1S2g4R1RoYXdrekJ1KzdKT2ZHd0gwZklWOGQ2bzE3ajYvTHdIOW1PRTFJQ2tOWTdkbFlOUXJmU3JqTm5sY21OV1JnUU5LblltRDgzbjFzS2Z2S1h5eHJhRkZyTmtXNzg1RUNYVVk5bS9wR2lhYnBRN2E4ZEFMczVlUzhOZkFQdXB1K2V3elZWZz09" } } } } }
Firstly, this post probably shouldn't be in the response I'm getting because I'm filtering for only photo
type files and it's marked as text
.
Secondly, and more importantly, the content
block seems to be raw HTML. I thought it was just a fluke until I opened up another random photos-like post to the same result. Adding filter=...
to the function call either leaves it unchanged or cuts all of the non-text content from the post.
My understanding is that it should look more like this:
(Low-effort creation based on the NPF API examples.)
{ "content": [ { "type": "image", "media": [ { "type": "image/jpeg", "url": "https://64.media.tumblr.com/ab6859e23877a7d3a47a12cac73f529a/0267aa057059a2a1-a2/s500x750/1758d513b10010d980864d10f7e75d72c40ee21a.jpg", "width": 1280, "height": 1073 }, { "type": "image/jpeg", "url": "https://64.media.tumblr.com/ab6859e23877a7d3a47a12cac73f529a/0267aa057059a2a1-a2/s500x750/1758d513b10010d980864d10f7e75d72c40ee21a.jpg", "width": 540, "height": 400 }, { "type": "image/jpeg", "url": "https://64.media.tumblr.com/ab6859e23877a7d3a47a12cac73f529a/0267aa057059a2a1-a2/s500x750/1758d513b10010d980864d10f7e75d72c40ee21a.jpg", "width": 250, "height": 150 } ], }, { "type": "text", "text": "The person's social information would be here." }, ], }
Am I misunderstanding the API?
(Oh, also the npf=true
flag doesn't seem to work for the client.posts()
function.)