Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  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("h2.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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement