cleanview
Version:
Clean the content of html articles
18 lines (17 loc) • 863 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const index_1 = __importDefault(require("../index"));
const name = "real-article-0";
const articleFile = `./source/${name}.html`;
const urlFile = `./source/${name}.txt`;
const articlePath = path_1.default.join(__dirname, articleFile);
const urlPath = path_1.default.join(__dirname, urlFile);
const article = fs_1.default.readFileSync(articlePath, { encoding: "utf-8" });
const url = fs_1.default.readFileSync(urlPath, { encoding: "utf-8" }).trim();
const clean = (0, index_1.default)(article, { url: url, includeTags: ["header"] });
console.log(clean);