Skip to content

Instantly share code, notes, and snippets.

Created August 19, 2015 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/b5ae949ef56025d852d6 to your computer and use it in GitHub Desktop.
Save anonymous/b5ae949ef56025d852d6 to your computer and use it in GitHub Desktop.
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