ns-rss-spider 0.0.21 → 0.0.22

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.
@@ -1,15 +1,18 @@
1
1
  import { ServerInfo } from "./upload";
2
2
  import { Article } from "./types";
3
- export declare function parseRss(name: string, feed: string, server?: ServerInfo): Promise<Article[] | {
4
- storePath: any;
5
- type: "simple" | "rich";
6
- guid: string;
7
- title: string;
8
- link: string;
9
- description: string;
10
- pubDate: Date;
11
- author?: string | undefined;
12
- source?: string | undefined;
13
- categories?: string | undefined;
14
- thumb?: string | undefined;
15
- }[]>;
3
+ export declare function parseRss(name: string, feed: string, server?: ServerInfo): Promise<never[] | {
4
+ contents: Article[] | {
5
+ storePath: any;
6
+ type: "rich" | "simple";
7
+ guid: string;
8
+ title: string;
9
+ link: string;
10
+ description: string;
11
+ pubDate: Date;
12
+ author?: string | undefined;
13
+ source?: string | undefined;
14
+ categories?: string | undefined;
15
+ thumb?: string | undefined;
16
+ }[];
17
+ thumbs: Record<string, string> | undefined;
18
+ }>;
package/dist/cjs/parse.js CHANGED
@@ -78,11 +78,13 @@ async function parseRss(name, feed, server) {
78
78
  contents.push(content);
79
79
  }
80
80
  }
81
+ let thumbs;
81
82
  if (strategy == null ? void 0 : strategy.getThumbs) {
82
83
  console.log(import_zx.chalk.green(`正在获取缩略图数据`));
83
84
  const thumbKv = await (strategy == null ? void 0 : strategy.getThumbs(contents));
84
85
  if (thumbKv && Object.keys(thumbKv).length) {
85
86
  console.log(import_zx.chalk.green(`正在更新缩略图`));
87
+ thumbs = thumbKv;
86
88
  contents.forEach((content) => {
87
89
  if (thumbKv[content.guid]) {
88
90
  content.thumb = thumbKv[content.guid];
@@ -102,9 +104,12 @@ async function parseRss(name, feed, server) {
102
104
  }).catch((e) => {
103
105
  });
104
106
  }
105
- return r;
107
+ return {
108
+ contents: r,
109
+ thumbs
110
+ };
106
111
  } else {
107
- return contents;
112
+ return { contents, thumbs };
108
113
  }
109
114
  }
110
115
  // Annotate the CommonJS export names for ESM import in node:
@@ -68,7 +68,7 @@ var cnbeta = {
68
68
  const html = res.data;
69
69
  const $ = (0, import_cheerio.load)(html, null, false);
70
70
  const kv = {};
71
- $("#it_tech .txt_thumb > a").each((_, $a) => {
71
+ $("#main > section li .txt_thumb > a").each((_, $a) => {
72
72
  var _a, _b;
73
73
  const thumb = $($a).find("img").attr("src");
74
74
  const href = $($a).attr("href") || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ns-rss-spider",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",