daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Run Inspector Console in chrome and copy and paste the following code in the /stats/stories view
  2.  
  3. function download(filename, text) {
  4.     var pom = document.createElement('a');
  5.     pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
  6.     pom.setAttribute('download', filename);
  7.  
  8.     if (document.createEvent) {
  9.         var event = document.createEvent('MouseEvents');
  10.         event.initEvent('click', true, true);
  11.         pom.dispatchEvent(event);
  12.     }
  13.     else {
  14.         pom.click();
  15.     }
  16. }
  17.  
  18. content = "";
  19. rows = document.querySelectorAll(".sortableTable-row.js-statsTableRow")
  20. rows.forEach(function(row) {
  21.   title = row.querySelectorAll(".sortableTable-title")[0].innerText
  22.   values = row.querySelectorAll(".sortableTable-value")
  23.   views = values[1].innerText
  24.   reads = values[2].innerText
  25.   readRatio = values[3].innerText
  26.   recommends = values[4].innerText
  27.   content += title + ";" + views + ";" + reads + ";" + readRatio + ";" + recommends + "\n"
  28. });
  29.  
  30. download("medium-metrics-" + new Date().toISOString().slice(0, 10) + ".csv", content)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top