ns-rss-spider 1.0.6 → 1.0.8
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.
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/parsers/mydrivers.ts
|
|
30
|
+
var mydrivers_exports = {};
|
|
31
|
+
__export(mydrivers_exports, {
|
|
32
|
+
mydrivers: () => mydrivers
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(mydrivers_exports);
|
|
35
|
+
var import_axios = __toESM(require("axios"));
|
|
36
|
+
var import_zx = require("zx");
|
|
37
|
+
var import_cheerio = require("cheerio");
|
|
38
|
+
var import_constants = require("../utils/constants");
|
|
39
|
+
var mydrivers = {
|
|
40
|
+
parse: true,
|
|
41
|
+
fetcher: "http",
|
|
42
|
+
getContentElementFromArticle: ($) => {
|
|
43
|
+
const el = $(".news_info");
|
|
44
|
+
return $(el);
|
|
45
|
+
},
|
|
46
|
+
getThumbs: async (articles) => {
|
|
47
|
+
const res = await import_axios.default.get("https://m.mydrivers.com/", {
|
|
48
|
+
responseType: "text",
|
|
49
|
+
headers: {
|
|
50
|
+
"User-Agent": import_constants.iosUA
|
|
51
|
+
}
|
|
52
|
+
}).catch((e) => {
|
|
53
|
+
console.error(import_zx.chalk.red("【get thumb】获取 html 错误"), e);
|
|
54
|
+
});
|
|
55
|
+
if (!res)
|
|
56
|
+
return void 0;
|
|
57
|
+
const html = res.data;
|
|
58
|
+
const $ = (0, import_cheerio.load)(html, null, false);
|
|
59
|
+
const kv = {};
|
|
60
|
+
$("#mynewslist li a.newsimg").each((_, $a) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const thumb = $($a).find("img").attr("src");
|
|
63
|
+
if (!thumb) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const href = $($a).attr("href") || "";
|
|
67
|
+
const reg = /([\d]+).htm/;
|
|
68
|
+
const articleId = (_a = reg.exec(href)) == null ? void 0 : _a[1];
|
|
69
|
+
const guid = (_b = articles.find((a) => {
|
|
70
|
+
var _a2;
|
|
71
|
+
const r = (_a2 = a.guid) == null ? void 0 : _a2.endsWith(`${articleId}.htm`);
|
|
72
|
+
return r;
|
|
73
|
+
})) == null ? void 0 : _b.guid;
|
|
74
|
+
if (guid && thumb) {
|
|
75
|
+
kv[guid] = thumb;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return kv;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
mydrivers
|
|
84
|
+
});
|
package/dist/cjs/strategy.js
CHANGED
|
@@ -28,13 +28,15 @@ var import_theverge = require("./parsers/theverge");
|
|
|
28
28
|
var import_ithome = require("./parsers/ithome");
|
|
29
29
|
var import_kr = require("./parsers/36kr");
|
|
30
30
|
var import_techrunch = require("./parsers/techrunch");
|
|
31
|
+
var import_mydrivers = require("./parsers/mydrivers");
|
|
31
32
|
var strategies = {
|
|
32
33
|
cnbeta: import_cnbeta.cnbeta,
|
|
33
34
|
ifanr: import_ifanr.ifanr,
|
|
34
35
|
theverge: import_theverge.theverge,
|
|
35
36
|
ithome: import_ithome.ithome,
|
|
36
37
|
"36kr": import_kr._36kr,
|
|
37
|
-
techrunch: import_techrunch.techrunch
|
|
38
|
+
techrunch: import_techrunch.techrunch,
|
|
39
|
+
mydrivers: import_mydrivers.mydrivers
|
|
38
40
|
};
|
|
39
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
42
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ns-rss-spider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dayjs": "^1.11.10",
|
|
40
40
|
"html-entities": "^2.4.0",
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
|
-
"playwright": "
|
|
42
|
+
"playwright": "1.41.2",
|
|
43
43
|
"probe-image-size": "^7.2.3",
|
|
44
44
|
"rss-parser": "^3.13.0",
|
|
45
45
|
"yargs-parser": "^21.1.1",
|