Commit eef6b14a authored by nanahira's avatar nanahira

fixes

parent 7241e206
......@@ -113,7 +113,7 @@ export function getString(node: HTML.Node) {
export function getNumber(node: HTML.Node) {
const numberStr = getString(node);
let stringMatch: RegExpMatchArray;
if (numberStr === "没有上榜") {
if (numberStr === "没有上榜" || !numberStr) {
return null;
} else if (stringMatch = numberStr.match(/^([天地])魂$/)) {
return stringMatch[1] === "" ? 2 : 1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { User } from "../src/user";
import fs from "fs";
import HTML from "posthtml-parser";
async function main() {
let html = await fs.promises.readFile("./tests/28_20588.html", "utf-8");
console.log(new User("28_20588", html, null));
html = await fs.promises.readFile("./tests/60_46782.html", "utf-8");
console.log(new User("60_46782", html, null));
let id = "28_20588";
let html = await fs.promises.readFile(`./tests/${id}.html`, "utf-8");
await fs.promises.writeFile(`./tests/${id}.json`, JSON.stringify(HTML(html), null, 2));
console.log(new User(id, html, null));
id = "6_18804822";
html = await fs.promises.readFile(`./tests/${id}.html`, "utf-8");
await fs.promises.writeFile(`./tests/${id}.json`, JSON.stringify(HTML(html), null, 2));
console.log(new User(id, html, null));
}
main();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment