Skip to content

Instantly share code, notes, and snippets.

@kwappa
Created June 2, 2024 01:55
Show Gist options
  • Save kwappa/e982d56fa4f268fecc25d073d3f63e75 to your computer and use it in GitHub Desktop.
Save kwappa/e982d56fa4f268fecc25d073d3f63e75 to your computer and use it in GitHub Desktop.
技術書典の月別販売状況ページからスプレッドシートにコピペできるTSVを得る
// 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