|
@@ -1,4 +1,4 @@
|
|
|
-import html, { HTMLElement } from "node-html-parser";
|
|
|
+import * as html from "node-html-parser";
|
|
|
import request from "request-promise-native";
|
|
|
import { Response } from "request";
|
|
|
import { INewsItem, IAggregator } from "./aggregator";
|
|
@@ -17,6 +17,11 @@ async function aggregate() {
|
|
|
where: { feedName: FEED_NAME },
|
|
|
order: { newsId: "DESC" }
|
|
|
});
|
|
|
+
|
|
|
+ if(!lastPost)
|
|
|
+ lastPost = repo.create({
|
|
|
+ newsId: 0
|
|
|
+ });
|
|
|
|
|
|
try {
|
|
|
let mainPageRes = await request(`${kissDiaryRoot}/diary.php`, {resolveWithFullResponse: true}) as Response;
|
|
@@ -30,7 +35,7 @@ async function aggregate() {
|
|
|
style: false
|
|
|
});
|
|
|
|
|
|
- if(!(rootNode instanceof HTMLElement))
|
|
|
+ if(!(rootNode instanceof html.HTMLElement))
|
|
|
return;
|
|
|
|
|
|
let diaryEntries = rootNode.querySelectorAll("div.blog_frame_middle ul.disc li a");
|
|
@@ -66,7 +71,7 @@ async function aggregate() {
|
|
|
style: false
|
|
|
});
|
|
|
|
|
|
- if(!(node instanceof HTMLElement))
|
|
|
+ if(!(node instanceof html.HTMLElement))
|
|
|
continue;
|
|
|
|
|
|
let title = node.querySelector("table.blog_frame_top tr td a");
|
|
@@ -74,7 +79,7 @@ async function aggregate() {
|
|
|
let bottomFrame = contents.querySelector("div.blog_data");
|
|
|
if(bottomFrame) {
|
|
|
let child = contents.childNodes[0];
|
|
|
- if(child instanceof HTMLElement)
|
|
|
+ if(child instanceof html.HTMLElement)
|
|
|
child.removeChild(bottomFrame);
|
|
|
}
|
|
|
|