ns-rss-spider 0.0.31 → 0.0.32

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,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/parsers/ifanr.ts
@@ -22,8 +32,41 @@ __export(ifanr_exports, {
22
32
  ifanr: () => ifanr
23
33
  });
24
34
  module.exports = __toCommonJS(ifanr_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");
25
39
  var ifanr = {
26
- parse: true
40
+ parse: false,
41
+ getThumbs: async (items) => {
42
+ const url = "https://www.ifanr.com/";
43
+ const res = await import_axios.default.get(url, {
44
+ responseType: "text",
45
+ headers: {
46
+ "User-Agent": import_constants.iosUA
47
+ }
48
+ }).catch((e) => {
49
+ console.error(import_zx.chalk.red(`获取 ${url} 错误`), e);
50
+ });
51
+ if (!res)
52
+ return void 0;
53
+ const html = res.data;
54
+ const $ = (0, import_cheerio.load)(html, null, false);
55
+ const kv = {};
56
+ $("#articles-list .article-item > a").each((_, $a) => {
57
+ var _a, _b, _c;
58
+ const bg = $($a).find(".left-box").css("background-image") || "";
59
+ const thumb = (_a = /url\(([\s\S]+)\)/.exec(bg)) == null ? void 0 : _a[1];
60
+ const href = $($a).attr("href") || "";
61
+ const reg = /ifanr.com\/([\d]+)/;
62
+ const articleId = (_b = reg.exec(href)) == null ? void 0 : _b[1];
63
+ const guid = (_c = items.find((a) => (a.guid || "").includes(`p=${articleId}`))) == null ? void 0 : _c.guid;
64
+ if (guid && thumb) {
65
+ kv[guid] = thumb;
66
+ }
67
+ });
68
+ return kv;
69
+ }
27
70
  };
28
71
  // Annotate the CommonJS export names for ESM import in node:
29
72
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ns-rss-spider",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",