

<?php
declare(strict_types=1);
/*
* Ranks accounts that voted on posts with the selected tag,
* among posts published within the last 24 hours.
*/
const HIVE_API = 'https://api.hive.blog';
const POSTS_PER_PAGE = 20; // Hive API limit
const MAX_POSTS = 500; // Maximum number of posts to analyze
const PAUSE_US = 300000; // Short pause between pages
/**
* Sends a request to the Hive API and returns its result.
*/
function callHive(string $method, array $parameters): array
{
$request = json_encode([
'jsonrpc' => '2.0',
'method' => $method,
'params' => $parameters,
'id' => 1,
], JSON_THROW_ON_ERROR);
usleep(PAUSE_US);
$curl = curl_init(HIVE_API);
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $request,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException('Connection error to Hive: ' . $message);
}
$httpCode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($httpCode === 429) {
throw new RuntimeException(
'Hive is temporarily rate-limiting requests. Try again in a moment.'
);
}
if ($httpCode < 200 || $httpCode >= 300) {
throw new RuntimeException('Hive responded with HTTP code ' . $httpCode);
}
$data = json_decode($response, true);
if (!is_array($data)) {
throw new RuntimeException('The Hive response could not be read.');
}
if (isset($data['error'])) {
$message = $data['error']['message'] ?? 'Unknown error';
throw new RuntimeException('Hive API error: ' . $message);
}
$result = $data['result'] ?? [];
return is_array($result) ? $result : [];
}
/**
* Escapes text displayed on the page.
*/
function escapeHtml(string $text): string
{
return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
$tag = isset($_GET['tag']) ? trim((string) $_GET['tag']) : '';
$error = '';
$ranking = [];
$postCount = 0;
$topAccount = '';
if ($tag !== '') {
$tag = strtolower(ltrim($tag, '#'));
if (!preg_match('/^[a-z0-9-]+$/', $tag)) {
$error = 'Enter a simple tag without spaces or special characters.';
} else {
try {
$cutoffTime = time() - 24 * 60 * 60;
$startAuthor = '';
$startPermlink = '';
while ($postCount < MAX_POSTS) {
$limit = min(POSTS_PER_PAGE, MAX_POSTS - $postCount);
$posts = callHive(
'condenser_api.get_discussions_by_created',
[[
'tag' => $tag,
'start_author' => $startAuthor,
'start_permlink' => $startPermlink,
'limit' => $limit,
'observer' => '',
'truncate_body' => 0,
]]
);
if ($posts === []) {
break;
}
$stop = false;
foreach ($posts as $post) {
$postTime = strtotime((string) ($post['created'] ?? ''));
// Posts are returned from newest to oldest.
if (!$postTime || $postTime < $cutoffTime) {
$stop = true;
break;
}
$postCount++;
// Votes are already included in the posts response.
$votes = $post['active_votes'] ?? [];
if (is_array($votes)) {
foreach ($votes as $vote) {
$voter = (string) ($vote['voter'] ?? '');
if ($voter !== '') {
$ranking[$voter] =
($ranking[$voter] ?? 0) + 1;
}
}
}
if ($postCount >= MAX_POSTS) {
break;
}
}
if ($stop || count($posts) < $limit || $postCount >= MAX_POSTS) {
break;
}
$lastPost = end($posts);
$startAuthor = (string) ($lastPost['author'] ?? '');
$startPermlink = (string) ($lastPost['permlink'] ?? '');
if ($startAuthor === '' || $startPermlink === '') {
break;
}
}
arsort($ranking);
if ($ranking !== []) {
$topAccount = (string) array_key_first($ranking);
}
} catch (Throwable $e) {
$error = $e->getMessage();
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hive Votes by Tag</title>
<style>
body {
max-width: 700px;
margin: 40px auto;
padding: 0 16px;
font-family: Arial, sans-serif;
line-height: 1.5;
}
input, button {
padding: 10px;
font-size: 16px;
}
input {
width: 220px;
}
.error {
color: #b00020;
}
.result {
margin-top: 24px;
padding: 16px;
background: #f1f7f1;
border-radius: 8px;
}
</style>
</head>
<body>
<h1>Who voted the most on this tag?</h1>
<form method="get">
<label for="tag">Hive tag:</label>
<input
type="text"
id="tag"
name="tag"
placeholder="example: pimp"
value="<?= escapeHtml($tag) ?>"
required
>
<button type="submit">Search</button>
</form>
<?php if ($error !== ''): ?>
<p class="error"><?= escapeHtml($error) ?></p>
<?php elseif ($tag !== ''): ?>
<div class="result">
<h2>Results for #<?= escapeHtml($tag) ?></h2>
<?php if ($topAccount !== ''): ?>
<p>
The account with the most votes is
<strong>@<?= escapeHtml($topAccount) ?></strong>,
with
<strong><?= (int) $ranking[$topAccount] ?> votes</strong>.
</p>
<?php else: ?>
<p>No votes found on the posts analyzed.</p>
<?php endif; ?>
<p><?= (int) $postCount ?> posts analyzed.</p>
</div>
<?php endif; ?>
</body>
</html>
Have you ever wondered which accounts vote most often on posts under a specific Hive tag? Whether you’re simply curious, want to understand a community’s activity, or are looking for accounts to consider for a voting trail, this tool gives you a quick snapshot of recent votes.
And let’s be honest: sometimes you just want to see what’s going on… out of curiosity. Or to “spy” on the tag’s voting activity—just a little, of course! 😄
The tool checks Hive posts associated with the tag you enter and counts how many posts each account has voted on.
For example, if you search for the pimp tag, the tool retrieves recent posts with that tag and checks the votes recorded on each one. It then ranks accounts by how many posts they voted on.
The results give you a quick overview of which accounts are most active in voting on posts under that tag, within the time period and post limit analyzed.
There are several reasons to check which accounts vote most often on a particular tag.
Hive is made up of many communities and topics. Each tag brings together posts about a particular subject, and the people voting on those posts may vary from one tag to another.
Checking the results can simply help you discover who is active in a community, which accounts regularly engage with posts on a topic, or how votes are distributed.
A voting trail generally follows the votes of a chosen account: when that account votes, your account may vote too, depending on your trail’s rules and settings.
If an account regularly votes on posts under a tag you’re interested in, you may want to take a closer look at it as a potential trail account. The tool can be a starting point for finding active accounts in that community.
However, the account with the most votes isn’t automatically the best choice for a trail. Before following an account, take some time to review its activity, the kinds of posts it supports, and whether its voting habits align with your own goals. The ranking shows voting frequency—it is not a recommendation.
You can also use the tool to get a glimpse of a tag’s voting patterns: which accounts are active, who votes regularly, and what recent activity looks like.
Let’s call it “spying” on public statistics. The tool uses votes that are visible on the posts it analyzes; it doesn’t access private information. 👀
It’s easy:
pimp.You can enter the tag with or without the # symbol. For example, #pimp and pimp will be treated the same way.
Tags can contain letters, numbers, and hyphens. Spaces and special characters aren’t accepted.
The tool uses the Hive API to retrieve posts associated with the tag you entered. It only considers posts created within the last 24 hours and analyzes up to 500 posts.
For each post, it checks the list of votes and adds one to the corresponding account’s count. Once the analysis is complete, accounts are ranked from the most votes to the fewest.
The page then displays:
If no votes are found on the posts analyzed, the page will say so.
The ranking counts the number of posts an account voted on. It does not measure the total weight or value of those votes, nor does it necessarily reflect the quality or relevance of the account’s support.
For example, an account that voted on ten posts will rank above an account that voted on five, even if the second account’s votes carry more weight.
So treat the results as an activity indicator, not a complete assessment of an account.
The tool stops after analyzing a maximum of 500 posts. If a tag is very active and has more than 500 posts from the last 24 hours, some recent posts won’t be included.
The results also depend on the data returned by Hive’s API when you run the search. They’re a snapshot of recent activity, not a complete or permanent record.
The code must be installed on a server that supports PHP and has the cURL extension enabled, which it uses to communicate with the Hive API.
A short pause is also built in between requests to avoid sending them too quickly.
This tool helps you quickly find out which accounts vote most often on recent Hive posts under a specific tag. You can use it out of curiosity, to better understand a community’s activity, or to find accounts worth reviewing before considering a voting trail.
And if you’re just using it to see who votes on what… well, there’s nothing wrong with being curious. 😉



Posted Using INLEO
!BBH !GLYPH
Las dos capturas del ranking dejan claro que el top de votantes se concentra en pocas cuentas, no en una masa distribuida. ¿El script cuenta votos únicos por post o suma cada vote aunque un mismo account vote varias veces en el tag?
For now, this is an initial draft of the code.
It makes it possible to track, over a 24-hour period, who has voted the most on posts containing a tag of our choosing.
I still need to refine it, to be more precise. !PIZZA !GLYPH