Created
June 2, 2024 01:55
-
-
Save kwappa/e982d56fa4f268fecc25d073d3f63e75 to your computer and use it in GitHub Desktop.
技術書典の月別販売状況ページからスプレッドシートにコピペできるTSVを得る
This file contains hidden or 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
// https://techbookfest.org/organization/********/sales | |
// 技術書典の月別販売状況ページからスプレッドシートにコピペできるTSVを得る | |
const rows = document.getElementsByClassName("MuiTableBody-root")[0].rows | |
const ary = Array.from(rows) | |
const r = ary.map(getRowValue) | |
console.log(r.join("\n")) | |
function getRowValue(row) { | |
const name = row.firstChild.firstChild.children[1].firstChild.firstChild.firstChild.textContent.trim() | |
const variation = row.firstChild.firstChild.children[1].firstChild.firstChild.lastChild.textContent.trim() | |
const count = row.children[1].textContent.replace('冊','').trim() | |
const revenue = row.children[2].textContent.trim() | |
return `"${name}"\t"${variation}"\t"${count}"\t"${revenue}"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment