Ich schreibe eine Anwendung, die die Anzahl der Likes für einen Tumblr Post in PHP bekommen muss. Ich benutze die Tumblr PHP library und habe erfolgreich authentifiziert und all das. Ich verwende Client::getBlogPosts()
, um eine Liste der Beiträge zu erhalten. Es gibt, was ist im Wesentlichen ein PHP-Array mit Informationen wie:Tumblr API: Gibt es eine Möglichkeit, die Anzahl der Likes zu erhalten, die ein Tumblr-Post erhält?
{
"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
}
]
}
Das nächstgelegene Feld zu dem, was ich suche ist note_count
, obwohl diese beiden Vorlieben und reblogs aggregiert. Wenn die note_count
0 ist, dann gibt es kein Problem, aber wenn die Anzahl der Noten 41 ist, kann ich nicht sagen, ob es 40 Mal gemocht wurde und einmal oder die Converse. Wie auch immer, die Anwesenheit oder Abwesenheit des Feldes liked
sagt Ihnen dies bereits.
Ich versuchte mit der Methode, aber das ruft eine Liste von Posts, die der Blog (in Tumblr Sprachausgabe, effektiv Beiträge, die der Benutzer erstellt hat), die das Gegenteil von dem, was ich gesucht bin.
Das Beste, was ich aus dem allgemeinen Internet bekommen könnte, ist dies article, die die URL api.tumblr.com/v2/blog/{base-hostname}/likes?api_key={key schlagen mit}, sondern als Soweit ich das anhand des Codes feststellen kann, ist dies das Gleiche wie die Verwendung der -Funktion aus der Tumblr-PHP-Bibliothek.
Kennt jemand einen Weg, um die Anzahl der Likes zu erhalten, die ein bestimmter Post erhalten hat? Es muss keine PHP-spezifische Lösung sein.
Leider ist es nicht möglich. 'note_count' ist eine Kombination aus likes und reblogs: http://tumblr.com/docs/en/api/v2#posts – mikedidthis
Mögliche Duplikate: http://stackoverflow.com/questions/29820031/how-to-get- individual-tumblr-posts-likes-count-fuer-tumblr-client-gem – mikedidthis