ProductHunt Javascript Hacks

I am planning to create a Chrome Browser plugin for PH to manage followers.

This is an ongoing note.

AI review pending
(can take a few minutes)
267 days 9 hrs ago

Show Notes

Print a List of people you are following

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Go to your Following page on ProductHunt.com
* Paste the following script on the console of Chrome's inspector window
*/

function printUsernamesFromFollowingButtons() {
let count = 0;
const processedUsernames = new Set();

function extractAndPrintUsernames() {
var buttons = document.querySelectorAll('button[data-test="follow-button"]');
let newButtonsFound = false;

buttons.forEach(button => {
if (button.innerText === "Following") {
var parent = button.parentElement;
var siblingLinks = parent.parentElement.querySelectorAll('a[href^="/@"]');
siblingLinks.forEach(link => {
var username = link.getAttribute('href').split('/@')[1];
if (username && !processedUsernames.has(username)) {
processedUsernames.add(username);
count += 1;
console.log(`${count} ${username}`); // Print the count and username
newButtonsFound = true;
}
});
}
});

return newButtonsFound;
}

function scrollAndExtract() {
const interval = setInterval(() => {
window.scrollBy(0, 1000); // Scroll down the page

setTimeout(() => {
const newButtonsFound = extractAndPrintUsernames(); // Extract and print usernames
if (!newButtonsFound) { // If no new buttons are found, stop scrolling
clearInterval(interval);
console.log("No more new buttons found.");
return;
}
}, 1000); // Wait for 1 second to load new content
}, 2000); // Scroll every 2 seconds
}

scrollAndExtract();
}

// Call the function to execute
printUsernamesFromFollowingButtons();
308 days 8 hrs ago
Ready to use ShowNotes?
Get Started
© 2025 EVOKNOW, Inc. All rights reserved.