Skip to content

Instantly share code, notes, and snippets.

@yaasita
Created August 11, 2023 19:07
Show Gist options
  • Save yaasita/b681cea42c25931be58812567c4df209 to your computer and use it in GitHub Desktop.
Save yaasita/b681cea42c25931be58812567c4df209 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
import fs from "fs";
import { JSDOM } from "jsdom";
const content = fs.readFileSync("tmp/index.html", "utf8");
const dom = new JSDOM(content);
const todayEvents = dom.window.document.querySelector(
"#calendarAria .calendarDateBox",
);
for (const e of todayEvents.querySelectorAll("dl")) {
const country = e.querySelector("img").alt;
if (country !== "アメリカ") {
continue;
}
const star = e.querySelector(".importance img").src;
if (!star.match(/star_quintuple/)) {
continue;
}
const time = e.querySelector(".time").textContent;
const name = e.querySelector(".name").textContent;
console.log(`${time.padStart(5)} ${name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment