ns-rss-spider 1.1.9 → 1.1.12
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
|
@@ -57,6 +57,9 @@ async function parseRss(name, feed, options) {
|
|
|
57
57
|
}
|
|
58
58
|
const contents = [];
|
|
59
59
|
const strategy = import_strategy.strategies[name];
|
|
60
|
+
if (strategy.filterRssList) {
|
|
61
|
+
result.items = strategy.filterRssList(result.items);
|
|
62
|
+
}
|
|
60
63
|
if (result.items.length) {
|
|
61
64
|
result.items.forEach((item) => {
|
|
62
65
|
if (!item.guid) {
|
package/dist/cjs/parsers/36kr.js
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/parsers/oschina-project.ts
|
|
20
|
+
var oschina_project_exports = {};
|
|
21
|
+
__export(oschina_project_exports, {
|
|
22
|
+
oschinaProject: () => oschinaProject
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(oschina_project_exports);
|
|
25
|
+
var oschinaProject = {
|
|
26
|
+
parse: true,
|
|
27
|
+
fetcher: "http",
|
|
28
|
+
getContentElementFromArticle: ($) => {
|
|
29
|
+
const el = $(".article-detail > .content");
|
|
30
|
+
$(el).find(".ad-wrap").remove();
|
|
31
|
+
return $(el);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
oschinaProject
|
|
37
|
+
});
|
package/dist/cjs/strategy.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_avanderlee = require("./parsers/avanderlee");
|
|
|
36
36
|
var import_iosdevweekly = require("./parsers/iosdevweekly");
|
|
37
37
|
var import_cssweekly = require("./parsers/cssweekly");
|
|
38
38
|
var import_javascriptweekly = require("./parsers/javascriptweekly");
|
|
39
|
+
var import_oschina_project = require("./parsers/oschina-project");
|
|
39
40
|
var strategies = {
|
|
40
41
|
cnbeta: import_cnbeta.cnbeta,
|
|
41
42
|
ifanr: import_ifanr.ifanr,
|
|
@@ -47,6 +48,7 @@ var strategies = {
|
|
|
47
48
|
tmtpost: import_tmtpost.tmtpost,
|
|
48
49
|
leiphone: import_leiphone.leiphone,
|
|
49
50
|
oschina: import_oschina.oschina,
|
|
51
|
+
"oschina-project": import_oschina_project.oschinaProject,
|
|
50
52
|
avanderlee: import_avanderlee.avanderlee,
|
|
51
53
|
iosdevweekly: import_iosdevweekly.iosdevweekly,
|
|
52
54
|
cssweekly: import_cssweekly.cssweekly,
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import type { AnyNode, Cheerio, CheerioAPI } from 'cheerio';
|
|
|
2
2
|
import { Item } from 'rss-parser';
|
|
3
3
|
import { SnapshotResult } from './parseContent/newsletter/types';
|
|
4
4
|
export type RssItem = Item & {
|
|
5
|
-
source
|
|
5
|
+
source: string;
|
|
6
6
|
author?: string;
|
|
7
7
|
};
|
|
8
8
|
interface ParseStrategyBase {
|
|
9
|
+
filterRssList?: (items: RssItem[]) => RssItem[];
|
|
9
10
|
parse: boolean;
|
|
10
11
|
fetcher?: 'http' | 'playwright';
|
|
11
12
|
getContentElementFromArticle?: (aritcle: CheerioAPI) => Cheerio<AnyNode>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ns-rss-spider",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"axios": "^1.6.7",
|
|
38
|
-
"cheerio": "
|
|
38
|
+
"cheerio": "1.0.0-rc.12",
|
|
39
39
|
"dayjs": "^1.11.10",
|
|
40
40
|
"html-entities": "^2.4.0",
|
|
41
41
|
"lodash": "^4.17.21",
|