ns-rss-spider 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/parse.js
CHANGED
|
@@ -49,6 +49,7 @@ async function parseRss(name, feed, server) {
|
|
|
49
49
|
if (!result.items.length) {
|
|
50
50
|
throw Error("rss no conent");
|
|
51
51
|
}
|
|
52
|
+
const originRss = [...result.items];
|
|
52
53
|
if (server == null ? void 0 : server.latest) {
|
|
53
54
|
const d = new Date(server.latest.pubDate);
|
|
54
55
|
console.log("server lastest", d, "before num", result.items.length);
|
|
@@ -83,7 +84,7 @@ async function parseRss(name, feed, server) {
|
|
|
83
84
|
let thumbs;
|
|
84
85
|
if (strategy == null ? void 0 : strategy.getThumbs) {
|
|
85
86
|
console.log(import_zx.chalk.green(`正在获取缩略图数据`));
|
|
86
|
-
const thumbKv = await (strategy == null ? void 0 : strategy.getThumbs(
|
|
87
|
+
const thumbKv = await (strategy == null ? void 0 : strategy.getThumbs(originRss));
|
|
87
88
|
if (thumbKv && Object.keys(thumbKv).length) {
|
|
88
89
|
console.log(import_zx.chalk.green(`正在更新缩略图`));
|
|
89
90
|
thumbs = thumbKv;
|
|
@@ -57,7 +57,7 @@ var cnbeta = {
|
|
|
57
57
|
};
|
|
58
58
|
},
|
|
59
59
|
ignoreProbeImage: true,
|
|
60
|
-
getThumbs: async (
|
|
60
|
+
getThumbs: async (items) => {
|
|
61
61
|
const res = await import_axios.default.get("https://m.cnbeta.com.tw/", {
|
|
62
62
|
responseType: "text"
|
|
63
63
|
}).catch((e) => {
|
|
@@ -74,7 +74,7 @@ var cnbeta = {
|
|
|
74
74
|
const href = $($a).attr("href") || "";
|
|
75
75
|
const reg = /([\d]+).htm/;
|
|
76
76
|
const articleId = (_a = reg.exec(href)) == null ? void 0 : _a[1];
|
|
77
|
-
const guid = (_b =
|
|
77
|
+
const guid = (_b = items.find((a) => (a.guid || a.link || "").includes(`/${articleId}.htm`))) == null ? void 0 : _b.guid;
|
|
78
78
|
if (guid && thumb) {
|
|
79
79
|
kv[guid] = thumb;
|
|
80
80
|
}
|
|
@@ -83,7 +83,7 @@ var ithome = {
|
|
|
83
83
|
const reg = /([\d]+).htm/;
|
|
84
84
|
const articleId = (_a = reg.exec(href)) == null ? void 0 : _a[1];
|
|
85
85
|
const guid = (_b = articles.find((a) => {
|
|
86
|
-
const r = /([\d]+)\/([\d]+).htm/.exec(a.guid);
|
|
86
|
+
const r = /([\d]+)\/([\d]+).htm/.exec(a.guid || a.link || "");
|
|
87
87
|
if (r && r[1] && r[2]) {
|
|
88
88
|
return `${r[1]}${r[2]}` === articleId;
|
|
89
89
|
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface ParseStrategy {
|
|
|
11
11
|
getContentFromHtml?: ($: CheerioAPI, node: Cheerio<AnyNode>) => string;
|
|
12
12
|
getExtraItems?: ($: CheerioAPI, current: RichArticle, item: Item) => Promise<Record<string, any>>;
|
|
13
13
|
ignoreProbeImage?: boolean;
|
|
14
|
-
getThumbs?: (
|
|
14
|
+
getThumbs?: (items: Item[]) => Promise<Record<string, string> | undefined>;
|
|
15
15
|
}
|
|
16
16
|
export interface SimpleArticle {
|
|
17
17
|
type: 'simple';
|
|
@@ -12,14 +12,14 @@ export declare function uploadContent({ app, getUploadApi, items, }: {
|
|
|
12
12
|
items: Article[];
|
|
13
13
|
} & ServerInfo): Promise<Article[] | {
|
|
14
14
|
storePath: any;
|
|
15
|
-
|
|
16
|
-
type: "rich" | "simple";
|
|
15
|
+
type: "simple" | "rich";
|
|
17
16
|
guid: string;
|
|
18
17
|
title: string;
|
|
19
18
|
link: string;
|
|
20
19
|
description: string;
|
|
21
20
|
pubDate: Date;
|
|
22
21
|
author?: string | undefined;
|
|
22
|
+
source?: string | undefined;
|
|
23
23
|
categories?: string | undefined;
|
|
24
24
|
thumb?: string | undefined;
|
|
25
25
|
}[]>;
|