ns-rss-spider 1.0.9 → 1.0.11
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.
|
@@ -74,7 +74,7 @@ var cnbeta = {
|
|
|
74
74
|
const kv = {};
|
|
75
75
|
$("#main > section li .txt_thumb > a").each((_, $a) => {
|
|
76
76
|
var _a, _b;
|
|
77
|
-
const thumb = $($a).find("img").attr("
|
|
77
|
+
const thumb = $($a).find("img").attr("src");
|
|
78
78
|
const href = $($a).attr("href") || "";
|
|
79
79
|
const reg = /([\d]+).htm/;
|
|
80
80
|
const articleId = (_a = reg.exec(href)) == null ? void 0 : _a[1];
|
|
@@ -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/tmtpost.ts
|
|
30
|
+
var tmtpost_exports = {};
|
|
31
|
+
__export(tmtpost_exports, {
|
|
32
|
+
tmtpost: () => tmtpost
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(tmtpost_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 tmtpost = {
|
|
40
|
+
parse: true,
|
|
41
|
+
fetcher: "http",
|
|
42
|
+
getContentElementFromArticle: ($) => {
|
|
43
|
+
const el = $("._content_mode ._bottom > article");
|
|
44
|
+
return $(el);
|
|
45
|
+
},
|
|
46
|
+
getThumbs: async (articles) => {
|
|
47
|
+
const res = await import_axios.default.get("https://www.tmtpost.com/new", {
|
|
48
|
+
responseType: "text",
|
|
49
|
+
headers: {
|
|
50
|
+
"User-Agent": import_constants.chromeUA
|
|
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
|
+
$(".showLeft .type-video-article > a.img-shade").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]+).html/;
|
|
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}.html`);
|
|
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
|
+
tmtpost
|
|
84
|
+
});
|
package/dist/cjs/strategy.js
CHANGED
|
@@ -29,6 +29,7 @@ var import_ithome = require("./parsers/ithome");
|
|
|
29
29
|
var import_kr = require("./parsers/36kr");
|
|
30
30
|
var import_techrunch = require("./parsers/techrunch");
|
|
31
31
|
var import_mydrivers = require("./parsers/mydrivers");
|
|
32
|
+
var import_tmtpost = require("./parsers/tmtpost");
|
|
32
33
|
var strategies = {
|
|
33
34
|
cnbeta: import_cnbeta.cnbeta,
|
|
34
35
|
ifanr: import_ifanr.ifanr,
|
|
@@ -36,7 +37,8 @@ var strategies = {
|
|
|
36
37
|
ithome: import_ithome.ithome,
|
|
37
38
|
"36kr": import_kr._36kr,
|
|
38
39
|
techrunch: import_techrunch.techrunch,
|
|
39
|
-
mydrivers: import_mydrivers.mydrivers
|
|
40
|
+
mydrivers: import_mydrivers.mydrivers,
|
|
41
|
+
tmtpost: import_tmtpost.tmtpost
|
|
40
42
|
};
|
|
41
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
44
|
0 && (module.exports = {
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const iosUA = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1";
|
|
2
|
+
export declare const chromeUA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
|
|
@@ -19,11 +19,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/utils/constants.ts
|
|
20
20
|
var constants_exports = {};
|
|
21
21
|
__export(constants_exports, {
|
|
22
|
+
chromeUA: () => chromeUA,
|
|
22
23
|
iosUA: () => iosUA
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(constants_exports);
|
|
25
26
|
var iosUA = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1";
|
|
27
|
+
var chromeUA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
|
|
26
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
29
|
0 && (module.exports = {
|
|
30
|
+
chromeUA,
|
|
28
31
|
iosUA
|
|
29
32
|
});
|