Created
June 3, 2024 11:36
-
-
Save edorian/57af8237f34bed3930b6d1c4d30d644b to your computer and use it in GitHub Desktop.
GitHub container registry download numbers
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
// Extract data for the "last 30 day downloads" svg | |
svg = document.querySelector('#repo-content-turbo-frame > div > div > div > div.d-flex.flex-column.flex-md-row.mt-n1.mt-2.gutter-condensed.gutter-lg.flex-column > div.col-12.col-md-3.flex-shrink-0 > div:nth-child(3) > div.container-lg.my-3.d-flex.clearfix > div.lh-condensed.d-inline-flex.flex-column.flex-items-baseline.tooltipped.tooltipped-s.mt-3 > svg'); | |
rows = []; | |
svg.childNodes.forEach((element) => { | |
if(element.tagName === 'rect') { | |
rows.push([element.getAttribute('data-date'), element.getAttribute('data-merge-count')]); | |
} | |
}); | |
let csvContent = "data:text/csv;charset=utf-8," | |
+ rows.map(e => e.join(",")).join("\n"); | |
var encodedUri = encodeURI(csvContent); | |
window.open(encodedUri); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment