Created
August 19, 2015 14:51
-
-
Save anonymous/b5ae949ef56025d852d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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