Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[...document.getElementsByClassName("a-t-J a-Wa-ka l-oi-cc l-t-Q a-t-J-yl")]
.map(element => {
const sizeTextSplit = element.childNodes[3].childNodes[0].childNodes[1].childNodes[0].innerText.split(
" "
);
return {
size: Number(sizeTextSplit[0]),
unit: sizeTextSplit[1],
node: element
};
})
.map(element => {
const SIZES_KB = { MB: 1024, GB: 1048576, KB: 1 };
return {
size: element.size * SIZES_KB[element.unit],
unit: element.unit,
node: element.node
};
})
.reduce((sum, element) => sum + element.size, 0);
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.