Tumblr API:有没有办法获取 Tumblr post 收到的点赞数?
Tumblr API: Is there a way to get the number of likes a Tumblr post receives?
我正在编写一个应用程序,它必须获取 PHP 中 Tumblr post 的点赞数。我正在使用 Tumblr PHP library 并已成功通过身份验证等等。我使用 Client::getBlogPosts()
来获取 post 的列表。它 returns 本质上是一个 PHP 数组,其中包含如下信息:
{
"blog_name": "jeteon",
"id": 92729317211,
"post_url": "http://jeteon.tumblr.com/post/92729317211/where-to-find-libxm-so-2-for-ubuntu",
"slug": "where-to-find-libxm-so-2-for-ubuntu",
"type": "link",
"date": "2014-07-24 13:43:04 GMT",
"timestamp": 1406209384,
"state": "published",
"format": "html",
"reblog_key": "oA2WcGac",
"tags": [
"dakota",
"ubuntu"
],
"short_url": "http://tmblr.co/Z9ROeu1MN6HTR",
"highlighted": [],
"note_count": 0,
"title": "Where to find libXm.so.2 for Ubuntu",
"url": "https://packages.debian.org/wheezy/lesstif2",
"author": null,
"excerpt": null,
"publisher": "packages.debian.org",
"description": "<p>I recently had to install Dakota (<a href=\"http://dakota.sandia.gov\">http://dakota.sandia.gov</a>) and after considerable trouble with prerequisites, found that the binary install on Ubuntu requires (amonst other umentioned libraries) a shared library called libXm.so.2. The library is in a package called lesstif2 which is no longer available, it seems. You can grab the DEB on the above link though.</p>",
"reblog": {
"tree_html": ""
},
"trail": [
{
"blog": {
"name": "jeteon",
"theme": {
"avatar_shape": "square",
"background_color": "#FAFAFA",
"body_font": "Helvetica Neue",
"header_bounds": "",
"header_image": "http://assets.tumblr.com/images/default_header/optica_pattern_10.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_image_focused": "http://assets.tumblr.com/images/default_header/optica_pattern_10_focused_v3.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_image_scaled": "http://assets.tumblr.com/images/default_header/optica_pattern_10_focused_v3.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_stretch": true,
"link_color": "#529ECC",
"show_avatar": true,
"show_description": true,
"show_header_image": true,
"show_title": true,
"title_color": "#444444",
"title_font": "Gibson",
"title_font_weight": "bold"
}
},
"post": {
"id": "92729317211"
},
"content": "<p>I recently had to install Dakota (<a href=\"http://dakota.sandia.gov\">http://dakota.sandia.gov</a>) and after considerable trouble with prerequisites, found that the binary install on Ubuntu requires (amonst other umentioned libraries) a shared library called libXm.so.2. The library is in a package called lesstif2 which is no longer available, it seems. You can grab the DEB on the above link though.</p>",
"is_root_item": true,
"is_current_item": true
}
]
}
与我要查找的内容最接近的字段是 note_count
,尽管它汇总了点赞和转发。如果note_count
为0,则没有问题,但是当笔记数为41时,我就分不清是40次点赞转发1次了,还是相反。无论哪种方式,liked
字段的存在与否已经告诉您这一点。
我尝试使用 Client::getBlogLikes()
方法,但它检索了博客喜欢的 post 的列表(用 Tumblr 的说法,实际上是创建用户喜欢的 post) ,这与我正在寻找的相反。
我能从一般互联网上得到的最好的是这个 article,它建议使用 URL api.tumblr.com/v2/blog/{base -hostname}/likes?api_key={key},但据我从代码中可以看出,这与使用 Tumblr PHP 图书馆。
有谁知道如何获取特定 post 收到的点赞数?它不需要是特定于 PHP 的解决方案。
似乎Tumblr API v2 docs,不,这是不可能的。您只能计算博客喜欢的总数,或人们喜欢的帖子。
万一有人还在搜索原始 post 后的 2 年...您可以通过将 ¬es_info=true
附加到您的 api 电话来做到这一点 - [的集合=12=] 对象将被返回。如果您遍历这些,您可以计算 post 类型。据我所知,post类型有:posted
(原来的post)、like
和reblog
。希望这对您有所帮助!
来自 json
响应的示例注释集合:(仅显示 1 个注释)
'notes': [{'avatar_shape': 'square',
'blog_name': 'xxx',
'blog_url': 'xxx',
'blog_uuid': 'xxx',
'followed': False,
'timestamp': 1505922448,
'type': 'like'}],
我正在编写一个应用程序,它必须获取 PHP 中 Tumblr post 的点赞数。我正在使用 Tumblr PHP library 并已成功通过身份验证等等。我使用 Client::getBlogPosts()
来获取 post 的列表。它 returns 本质上是一个 PHP 数组,其中包含如下信息:
{
"blog_name": "jeteon",
"id": 92729317211,
"post_url": "http://jeteon.tumblr.com/post/92729317211/where-to-find-libxm-so-2-for-ubuntu",
"slug": "where-to-find-libxm-so-2-for-ubuntu",
"type": "link",
"date": "2014-07-24 13:43:04 GMT",
"timestamp": 1406209384,
"state": "published",
"format": "html",
"reblog_key": "oA2WcGac",
"tags": [
"dakota",
"ubuntu"
],
"short_url": "http://tmblr.co/Z9ROeu1MN6HTR",
"highlighted": [],
"note_count": 0,
"title": "Where to find libXm.so.2 for Ubuntu",
"url": "https://packages.debian.org/wheezy/lesstif2",
"author": null,
"excerpt": null,
"publisher": "packages.debian.org",
"description": "<p>I recently had to install Dakota (<a href=\"http://dakota.sandia.gov\">http://dakota.sandia.gov</a>) and after considerable trouble with prerequisites, found that the binary install on Ubuntu requires (amonst other umentioned libraries) a shared library called libXm.so.2. The library is in a package called lesstif2 which is no longer available, it seems. You can grab the DEB on the above link though.</p>",
"reblog": {
"tree_html": ""
},
"trail": [
{
"blog": {
"name": "jeteon",
"theme": {
"avatar_shape": "square",
"background_color": "#FAFAFA",
"body_font": "Helvetica Neue",
"header_bounds": "",
"header_image": "http://assets.tumblr.com/images/default_header/optica_pattern_10.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_image_focused": "http://assets.tumblr.com/images/default_header/optica_pattern_10_focused_v3.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_image_scaled": "http://assets.tumblr.com/images/default_header/optica_pattern_10_focused_v3.png?_v=eafbfb1726b334d86841955ae7b9221c",
"header_stretch": true,
"link_color": "#529ECC",
"show_avatar": true,
"show_description": true,
"show_header_image": true,
"show_title": true,
"title_color": "#444444",
"title_font": "Gibson",
"title_font_weight": "bold"
}
},
"post": {
"id": "92729317211"
},
"content": "<p>I recently had to install Dakota (<a href=\"http://dakota.sandia.gov\">http://dakota.sandia.gov</a>) and after considerable trouble with prerequisites, found that the binary install on Ubuntu requires (amonst other umentioned libraries) a shared library called libXm.so.2. The library is in a package called lesstif2 which is no longer available, it seems. You can grab the DEB on the above link though.</p>",
"is_root_item": true,
"is_current_item": true
}
]
}
与我要查找的内容最接近的字段是 note_count
,尽管它汇总了点赞和转发。如果note_count
为0,则没有问题,但是当笔记数为41时,我就分不清是40次点赞转发1次了,还是相反。无论哪种方式,liked
字段的存在与否已经告诉您这一点。
我尝试使用 Client::getBlogLikes()
方法,但它检索了博客喜欢的 post 的列表(用 Tumblr 的说法,实际上是创建用户喜欢的 post) ,这与我正在寻找的相反。
我能从一般互联网上得到的最好的是这个 article,它建议使用 URL api.tumblr.com/v2/blog/{base -hostname}/likes?api_key={key},但据我从代码中可以看出,这与使用 Tumblr PHP 图书馆。
有谁知道如何获取特定 post 收到的点赞数?它不需要是特定于 PHP 的解决方案。
似乎Tumblr API v2 docs,不,这是不可能的。您只能计算博客喜欢的总数,或人们喜欢的帖子。
万一有人还在搜索原始 post 后的 2 年...您可以通过将 ¬es_info=true
附加到您的 api 电话来做到这一点 - [的集合=12=] 对象将被返回。如果您遍历这些,您可以计算 post 类型。据我所知,post类型有:posted
(原来的post)、like
和reblog
。希望这对您有所帮助!
来自 json
响应的示例注释集合:(仅显示 1 个注释)
'notes': [{'avatar_shape': 'square',
'blog_name': 'xxx',
'blog_url': 'xxx',
'blog_uuid': 'xxx',
'followed': False,
'timestamp': 1505922448,
'type': 'like'}],