Skip to content

Instantly share code, notes, and snippets.

@gsfci gsfci/PikaLogger.js
Last active Jan 7, 2018

Embed
What would you like to do?
var comments = document.getElementsByClassName("comment");
var textToSave = "";
for(var i = 0; i < comments.length - 1; i++){
var comment = comments[i];
var comm_body = comment.getElementsByClassName("comment__content")[0];
var comm_header = comment.getElementsByClassName("comment__header")[0];
var comm_user = comm_header.getElementsByClassName("comment__user")[0];
var comm_username = comm_user.getElementsByClassName("user")[0].href.substr(22);
var comm = comm_body.innerText.replace(" ", "");
var comm_id = comment.id;
textToSave = textToSave.concat("\r\n");
textToSave = textToSave.concat(comm_username).concat("[").concat(comm_id).concat("]").concat("\r\n");
textToSave = textToSave.concat(comm);
}
var textToSaveblob = new Blob([textToSave], {type:"text/plain"});
var textToSaveurl = window.URL.createObjectURL(textToSaveblob);
var downlink = document.createElement("a");
downlink.download = "Pikabu-comments-parsed.txt";
downlink.href = textToSaveurl;
document.body.appendChild(downlink);
downlink.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.