Try running this in the browser console in any page under stackoverflow.com.
<obligatory "don't run code you don't trust or don't understand in your browser console" here>
It fetches each page (with some delay in between to avoid getting hit with rate-limit) and parses out voting events from your https://stackoverflow.com/users/<user-ID>/<username>?tab=votes
page (short-circuits once something is found). It'll print the post ID, vote-timestamp, and page number (of the page in your votes section of your profile page).
let postIdToFind = ; // TODO (number)
let postTypeToFind = ; // TODO "questions" or "answers"
let siteRoot = "https://stackoverflow.com";
let userId = parseInt(document.querySelector(".s-topbar--container .s-user-card__small").href.split("/")[4]);
let millisBetweenRequests = 2000; // avoid getting blocked by rate-limit
async function getHtmlDoc(url) {
const html = await (await fetch(url)).text();
const parser = new DOMParser();
return parser.parseFromString(html, "text/html");
}
let data = (await (async function() {
let postToFindCreationDate = new Date((await getHtmlDoc(`${siteRoot}/${postTypeToFind}/${postIdToFind}`))
.querySelector(".question .post-signature.owner .user-action-time > *").getAttribute("title")
);
const numPages = parseInt([...(
await getHtmlDoc(`${siteRoot}/users/${userId}/user?tab=votes&sort=upvote`)
).querySelectorAll(".js-pagination-item")].reverse()[1].textContent);
for (let pageNum = 0; pageNum < numPages; pageNum++) {
const doc = await getHtmlDoc(`${siteRoot}/users/${userId}/user?tab=votes&sort=upvote&page=${pageNum+1}`);
const els = [...doc.querySelectorAll(".js-expandable-posts .js-post-expandable")];
let data = els.map((el) => ({
postId: parseInt(el.querySelector(".answer-hyperlink,.question-hyperlink").href.split("/")[4]),
time: new Date(el.querySelector(".relativetime").getAttribute("title")),
pageNum,
}));
if (data.some(d => d.time < postToFindCreationDate)) { return null; }
// ^optimization relies on traversal order being from most recent to least recent vote-date
data = data.filter(d => d.postId === postIdToFind);
if (data.length > 0) { // apparently there can be multiple? or I'm just crazy?
return data;
}
console.log(`nothing found in page ${pageNum+1}`);
await (new Promise((resolve) => { setTimeout(resolve, millisBetweenRequests); }));
}
return null;
})());
console.log(data);
No SEDE, sadly, since voting data is anonymous (as it should be), and either I just can't read, or the API has no dice either.