Skip to content

Instantly share code, notes, and snippets.

@umeruma
Last active August 9, 2023 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umeruma/2c894c3a3c8adb782bb5b7c348014c3e to your computer and use it in GitHub Desktop.
Save umeruma/2c894c3a3c8adb782bb5b7c348014c3e to your computer and use it in GitHub Desktop.
mymindをスクロールしてカードのURLをリスト化する, login mymind on pc browser, open console and run script.
const height = document.body.getBoundingClientRect().height
const inHeight = window.innerHeight
const scrollNum = Math.floor(height / inHeight)
let cards = {}
const DEF_DELAY = 1000
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms || DEF_DELAY))
}
for (let i = 0; i <= scrollNum; i++) {
window.scrollTo(0, i * inHeight)
await sleep() // ネットワークによっては遅くする
for (let j = 0; j < document.getElementsByTagName('mymind-card').length; j++) {
const item = document.getElementsByTagName('mymind-card').item(j)
if (item.getElementsByClassName('link-bubble').item(0)) {
cards[item.getAttribute('data-id')] = item.getElementsByClassName('link-bubble').item(0).href
}
}
}
console.log(Object.values(cards).toString().split(",").join("\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment