Skip to content

Instantly share code, notes, and snippets.

@wlonkly
Last active September 27, 2025 01:23
Show Gist options
  • Save wlonkly/fa7ec63da593e540b674f9485dfadc0f to your computer and use it in GitHub Desktop.
Save wlonkly/fa7ec63da593e540b674f9485dfadc0f to your computer and use it in GitHub Desktop.
Reddit subscriber count userscript - now moved to Greasyfork, see downloadURL
// ==UserScript==
// @name Restore Reddit subscriber count
// @namespace Violentmonkey Scripts
// @match *://*reddit.com/*
// @grant GM_xmlhttpRequest
// @version 0.3.1
// @author https://github.com/wlonkly/
// @downloadURL https://update.greasyfork.org/scripts/550811/Restore%20Reddit%20subscriber%20count.user.js
// @description Re-adds the missing subscriber count on Old Reddit subreddit pages.
// ==/UserScript==
(function() {
'use strict';
// captures up to "/r/subreddit". technically you can also get
// an about.json from an individual post page with a different data
// structure, but that's more work than this.
const statsUrl = window.location.href.split('/').slice(0,5).join('/') + "/about.json";
console.log("subreddit stats URL: " + statsUrl)
GM_xmlhttpRequest({
method: 'GET',
url: statsUrl,
onload: function(response) {
try {
const resp = JSON.parse(response.responseText);
let subscribers;
if (resp.data?.subscribers !== undefined) {
subscribers = resp.data.subscribers.toLocaleString();
} else {
subscribers = "[unknown]";
}
// Find target element and append
const div = document.createElement('div');
div.textContent = subscribers + ' subscribers'
const target = document.querySelector('h1[class="hover redditname"]');
if (target) {
target.after(div);
} else {
console.warn('Target element not found, appending to body');
document.body.appendChild(div);
}
} catch (error) {
console.error('Failed to parse stats:', error);
}
},
onerror: function() {
console.error('Failed to fetch stats');
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment