ns-rss-spider 1.0.2 → 1.0.4

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/cli.js CHANGED
@@ -50,11 +50,12 @@ async function main() {
50
50
  }
51
51
  if (process.env.DISP_ARGV) {
52
52
  console.info("写入结果文件");
53
- return (0, import_promises.writeFile)("./result.json", JSON.stringify(rst || {}));
53
+ await (0, import_promises.writeFile)("./result.json", JSON.stringify(rst || {}));
54
54
  } else {
55
55
  console.info("输出结果");
56
56
  console.log(rst);
57
57
  }
58
+ console.log("done");
58
59
  }
59
60
  main().catch((err) => {
60
61
  console.error(import_zx.chalk.red(err.message));
@@ -22,9 +22,6 @@ __export(techrunch_exports, {
22
22
  techrunch: () => techrunch
23
23
  });
24
24
  module.exports = __toCommonJS(techrunch_exports);
25
- var import_zx = require("zx");
26
- var import_constants = require("../utils/constants");
27
- var import_browser = require("../utils/browser");
28
25
  var techrunch = {
29
26
  parse: true,
30
27
  fetcher: "http",
@@ -32,30 +29,28 @@ var techrunch = {
32
29
  const el = $(".article-content");
33
30
  return el;
34
31
  },
35
- ignoreProbeImage: true,
36
- getThumbs: async (items) => {
37
- var _a, _b;
38
- const url = "https://techcrunch.com/";
39
- const initialState = await (0, import_browser.runInPage)(url, async (page) => {
40
- const data = await page.evaluate(async () => window.tc_app_data);
41
- return data;
42
- }, {
43
- userAgent: import_constants.iosUA
44
- }).catch((e) => {
45
- console.error(import_zx.chalk.red(`获取 ${url} 错误`), e);
46
- });
47
- if ((_b = (_a = initialState == null ? void 0 : initialState.entities) == null ? void 0 : _a.posts) == null ? void 0 : _b.length) {
48
- const idThumbKv = initialState.entities.posts.reduce((prev, item) => {
49
- var _a2;
50
- if (((_a2 = item == null ? void 0 : item.guid) == null ? void 0 : _a2.rendered) && item.jetpack_featured_media_url) {
51
- prev[item.guid.rendered] = item.jetpack_featured_media_url;
52
- }
53
- return prev;
54
- }, {});
55
- return idThumbKv;
56
- }
57
- return void 0;
58
- }
32
+ ignoreProbeImage: true
33
+ //getThumbs: async (items) => {
34
+ // const url = 'https://techcrunch.com/';
35
+ // const initialState = await runInPage(url, async (page) => {
36
+ // const data = await page.evaluate(async () => (window as any).tc_app_data);
37
+ // return data;
38
+ // } , {
39
+ // userAgent: iosUA,
40
+ // }).catch(e => {
41
+ // console.error(chalk.red(`获取 ${url} 错误`), e);
42
+ // });
43
+ // if (initialState?.entities?.posts?.length) {
44
+ // const idThumbKv = (initialState.entities.posts as Array<any>).reduce<Record<string, string>>((prev, item) => {
45
+ // if (item?.guid?.rendered && item.jetpack_featured_media_url) {
46
+ // prev[item.guid.rendered] = item.jetpack_featured_media_url;
47
+ // }
48
+ // return prev;
49
+ // }, {});
50
+ // return idThumbKv;
51
+ // }
52
+ // return undefined;
53
+ //}
59
54
  };
60
55
  // Annotate the CommonJS export names for ESM import in node:
61
56
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ns-rss-spider",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",