Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function messageIdToRoomId (mid) {
return fetch(`http://crossorigin.me/http://chat.stackoverflow.com/messages/${mid}/history`).then(function (res) {
return res.text();
}).then(function (html) {
return new DOMParser().parseFromString(html, 'text/html');
}).then(function (doc) {
return doc.querySelector(`a[name="${mid}"]`).getAttribute('href').match(/\d+/)[0];
});
}
var data = [25159129,25169597,25169597,25146812]; // add more ids to this I guess :/
window.store = [];
var i = 0;
function doAll () {
messageIdToRoomId(data[i]).then(function (rid) {
store.push({mid: data[i], rid: rid});
i++;
data[i] ? doAll() : console.log('done. execute copy(JSON.stringify(window.store, null, " ")) now');
});
}
doAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment