Skip to content

Instantly share code, notes, and snippets.

@hUwUtao
Created January 21, 2024 13:11
Show Gist options
  • Save hUwUtao/bd4a8a040b2dd07dc1a5867019188c04 to your computer and use it in GitHub Desktop.
Save hUwUtao/bd4a8a040b2dd07dc1a5867019188c04 to your computer and use it in GitHub Desktop.
simai explode
copy(
[...document.querySelectorAll("table")]
.slice(1, -3)
.flatMap((d) =>
[...d.querySelector("tbody").querySelectorAll("tr")].map((r) =>
[...r.querySelectorAll("td")].map((r) => r.innerHTML),
),
)
.map((r) =>
r[0].startsWith("<a")
? [
...(
/<a href="\/\/w.atwiki.jp\/simai\/pages\/([^"]*)" title="([^"]*)">/.exec(
r[0],
) || []
).slice(1),
].join(",")
: "",
)
.filter(Boolean)
.join("\n"),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment