Search code examples
javascriptbrowserweb-console

How to update read books in goodreads as per the updated date?


I am trying to use java script to update the goodreads data using the webconsole in firefox (Inspect element). I forgot to update the read date when I added the rating for some books. It's very tedious to update the date by hand. I agree that this is a problem with goodreads (or my usage of it).

Does anyone know how to update this?

enter image description here


Solution

  • Try this code in your browser console. This should do the trick.

    var books = document.getElementById("books")
    
    for (var j = 1; j<= books.rows.length; j++) {
       var id = books.rows[j].cells[2].getElementsByClassName("tooltipTrigger")[0].getAttribute("data-resource-id");
       var date_added = books.rows[j].cells[23].innerText;
       books.rows[j].cells[22].getElementsByTagName("a")[0].click();
       reviewEditor.afterSummon(this, id, "read_at", {value: date_added, reading_session_id: "new"} );
       reviewEditor.save();
    }