From 138fb79715c4bc444c228780d7ab2af2b60bd2c9 Mon Sep 17 00:00:00 2001 From: Ron Nuss Date: Tue, 22 Aug 2023 13:06:55 +0300 Subject: [PATCH] feat(v0.6.0-beta) --- .github/ISSUE_TEMPLATE/bug-report.yml | 16 +- .github/workflows/main.yml | 9 +- README.md | 33 +- build/getArticle/index.d.ts | 6 + build/getArticle/index.js | 85 +++ build/getArticle/index.js.map | 1 + build/index.d.ts | 5 +- build/index.js | 8 +- build/index.js.map | 2 +- build/todayNews/index.d.ts | 6 +- build/todayNews/index.js | 117 ++-- build/todayNews/index.js.map | 2 +- package-lock.json | 805 ++++++++++++++++++++++++++ package.json | 5 +- src/getArticle/index.ts | 36 ++ src/index.ts | 5 +- src/todayNews/index.ts | 121 +++- tests/test.js | 9 +- 18 files changed, 1179 insertions(+), 92 deletions(-) create mode 100644 build/getArticle/index.d.ts create mode 100644 build/getArticle/index.js create mode 100644 build/getArticle/index.js.map create mode 100644 package-lock.json create mode 100644 src/getArticle/index.ts diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 87b6423..ae4ed55 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -17,9 +17,9 @@ body: description: | Steps to reproduce the behavior: value: | - 1. Install the package - 2. Use '...' - 3. Get error + 1. + 2. + 3. validations: required: true - type: 'input' @@ -33,8 +33,14 @@ body: id: 'lib-version' attributes: label: 'Hidabroot API Version' - description: 'The version of library you use.' - placeholder: '0.5.0' + description: 'The version of the package you used (you can run `npm list hidabroot` to find it).' + validations: + required: true + - type: 'input' + id: 'lib-version' + attributes: + label: 'Puppeteer Version' + description: 'The version of puppeteer you are using (you can run `npm list puppeteer` to find it).' validations: required: true - type: 'checkboxes' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 320e1e9..18b6ae5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,9 @@ +name: Publish + on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + release: + types: [created] + jobs: publish: runs-on: ubuntu-latest diff --git a/README.md b/README.md index f805811..c7a1465 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ _An (unofficial) API for Hidabroot_ ## Important + This API may be blocked at any time by Hidabroot's team. If any damage caused by this API, it is not my fault, use this API at your own risk. ## Install @@ -25,25 +26,51 @@ yarn add hidabroot ## Features #### Note + The current version is still in beta, meaning more features are coming soon and still in development. - [Getting the news titles from the website](#todaynews) +- [Viewing articles contents](#getarticle) ## API ### todayNews -Returns a promise that resolves to an array of 4 strings (if there is an error it will return null instead) of the top "Hadshot Hayom" from Hidabroot's website. +Returns a promise that resolves to a JSON of 5 keys. Each key is the article title, and each key's value is the ID of the article (if there is an error or an issue with getting the values, it will return an empty string as the article title and 0 as the ID) of the top "Hadshot Hayom" from Hidabroot's website. The first key is the biggest box at the top of the page, while the other 4 are the smaller under it. #### Example: ```js -const Hidabroot = require("hidabroot"); -Hidabroot.todayNews().then((result) => { +const { todayNews } = require("hidabroot"); +todayNews().then((result) => { console.log(result); }); ``` +### getArticle + +Returns a promise that resolves to a string (or null, if the article was not found). Here is a detailed table of the parameters of the function: + +| Field | Type | Description | Required | +| ----- | ------ | ------------------------------------------------------------------------------------------ | -------- | +| id | number | The ID of the article. Can be found in `https://www.hidabroot.org/article/X` (X is the ID) | yes | + +#### Example: + +```js +const { todayNews, getArticle } = require("hidabroot"); +todayNews().then((article) => { + //gets todays news + const desiredKey = Object.keys(article)[0]; + //gets the first key in the json. the first article is the biggest box at the top + getArticle(article[desiredKey]).then((articleContent) => { + //gets the article content of the biggest box at the top + console.log(articleContent); + //returns the content to the console + }); +}); +``` + ## Contributing All contributions are welcome! Feel free to open an issue or a pull request. diff --git a/build/getArticle/index.d.ts b/build/getArticle/index.d.ts new file mode 100644 index 0000000..41ecd9f --- /dev/null +++ b/build/getArticle/index.d.ts @@ -0,0 +1,6 @@ +/** + * Get any article content by it's ID. + * + * @param {number} id The id of the article + */ +export declare function getArticle(id: number): Promise; diff --git a/build/getArticle/index.js b/build/getArticle/index.js new file mode 100644 index 0000000..8dd4221 --- /dev/null +++ b/build/getArticle/index.js @@ -0,0 +1,85 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getArticle = void 0; +var cheerio_1 = __importDefault(require("cheerio")); +/** + * Get any article content by it's ID. + * + * @param {number} id The id of the article + */ +function getArticle(id) { + return __awaiter(this, void 0, void 0, function () { + var url; + return __generator(this, function (_a) { + url = "https://www.hidabroot.org/article/" + id; + try { + return [2 /*return*/, fetch(url) + .then(function (response) { return response.text(); }) + .then(function (html) { + var $ = cheerio_1.default.load(html); + var header = $(".page\\_title.no\\_border").eq(0).text(); + var output = ""; + if (header == "דף שגיאה 404 - אבל יש לנו הצעות אחרות!...") { + output = null; + } + else { + $('p[dir="RTL"]').each(function (index, p) { + output += $(p).text(); + }); + } + return output; + }) + .catch(function (error) { + console.error("Error: " + error); + return null; + })]; + } + catch (err) { + console.error("Error:", err); + return [2 /*return*/, null]; + } + return [2 /*return*/]; + }); + }); +} +exports.getArticle = getArticle; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/getArticle/index.js.map b/build/getArticle/index.js.map new file mode 100644 index 0000000..3da8a1c --- /dev/null +++ b/build/getArticle/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/getArticle/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA8B;AAE9B;;;;GAIG;AACH,SAAsB,UAAU,CAAC,EAAU;;;;YACnC,GAAG,GAAG,oCAAoC,GAAG,EAAE,CAAC;YAEtD,IAAI;gBACF,sBAAO,KAAK,CAAC,GAAG,CAAC;yBACd,IAAI,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,IAAI,EAAE,EAAf,CAAe,CAAC;yBACnC,IAAI,CAAC,UAAC,IAAI;wBACT,IAAM,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAC7B,IAAM,MAAM,GAAG,CAAC,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;wBAC3D,IAAI,MAAM,GAAkB,EAAE,CAAC;wBAC/B,IAAI,MAAM,IAAI,2CAA2C,EAAE;4BACvD,MAAM,GAAG,IAAI,CAAC;yBACjB;6BAAM;4BACL,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAC,KAAK,EAAE,CAAC;gCAC9B,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;4BACxB,CAAC,CAAC,CAAC;yBACJ;wBAED,OAAO,MAAM,CAAC;oBAChB,CAAC,CAAC;yBACD,KAAK,CAAC,UAAC,KAAK;wBACX,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;wBACjC,OAAO,IAAI,CAAC;oBACd,CAAC,CAAC,EAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBAC7B,sBAAO,IAAI,EAAC;aACb;;;;CACF;AA5BD,gCA4BC"} \ No newline at end of file diff --git a/build/index.d.ts b/build/index.d.ts index 30bd111..12c45b8 100644 --- a/build/index.d.ts +++ b/build/index.d.ts @@ -1,2 +1,3 @@ -import { todayNews } from "./todayNews/index"; -export { todayNews }; +import { todayNews } from "./todayNews"; +import { getArticle } from "./getArticle"; +export { todayNews, getArticle }; diff --git a/build/index.js b/build/index.js index ac085a5..bde712b 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.todayNews = void 0; -var index_1 = require("./todayNews/index"); -Object.defineProperty(exports, "todayNews", { enumerable: true, get: function () { return index_1.todayNews; } }); +exports.getArticle = exports.todayNews = void 0; +var todayNews_1 = require("./todayNews"); +Object.defineProperty(exports, "todayNews", { enumerable: true, get: function () { return todayNews_1.todayNews; } }); +var getArticle_1 = require("./getArticle"); +Object.defineProperty(exports, "getArticle", { enumerable: true, get: function () { return getArticle_1.getArticle; } }); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map index 3f37a97..df6928a 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAErC,0FAFA,iBAAS,OAEA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAG/B,0FAHA,qBAAS,OAGA;AAFlB,2CAA0C;AAEtB,2FAFX,uBAAU,OAEW"} \ No newline at end of file diff --git a/build/todayNews/index.d.ts b/build/todayNews/index.d.ts index 6bc2929..ea41bde 100644 --- a/build/todayNews/index.d.ts +++ b/build/todayNews/index.d.ts @@ -1,6 +1,8 @@ /** * Retrieves the news titles from "Hadshot Hayom" and returns them in a JSON format. * - * @returns {Promise} An array of news titles extracted from the website or null if an error occurs. + * @returns {Promise<{ [key: string]: number }>} An array of news titles extracted from the website or null if an error occurs. */ -export declare function todayNews(): Promise; +export declare function todayNews(): Promise<{ + [key: string]: number; +}>; diff --git a/build/todayNews/index.js b/build/todayNews/index.js index 11a62a5..f1c2b38 100644 --- a/build/todayNews/index.js +++ b/build/todayNews/index.js @@ -40,55 +40,92 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.todayNews = void 0; -var puppeteer_1 = __importDefault(require("puppeteer")); var cheerio_1 = __importDefault(require("cheerio")); /** * Retrieves the news titles from "Hadshot Hayom" and returns them in a JSON format. * - * @returns {Promise} An array of news titles extracted from the website or null if an error occurs. + * @returns {Promise<{ [key: string]: number }>} An array of news titles extracted from the website or null if an error occurs. */ function todayNews() { return __awaiter(this, void 0, void 0, function () { - var url, browser, page, htmlContent, $, articleBlocks, jsonResponse, err_1; + var url; return __generator(this, function (_a) { - switch (_a.label) { - case 0: - url = "https://www.hidabroot.org/%D7%97%D7%93%D7%A9%D7%95%D7%AA-%D7%94%D7%99%D7%95%D7%9D"; - _a.label = 1; - case 1: - _a.trys.push([1, 7, , 8]); - return [4 /*yield*/, puppeteer_1.default.launch({ - headless: "new", - })]; - case 2: - browser = _a.sent(); - return [4 /*yield*/, browser.newPage()]; - case 3: - page = _a.sent(); - return [4 /*yield*/, page.goto(url)]; - case 4: - _a.sent(); - return [4 /*yield*/, page.content()]; - case 5: - htmlContent = _a.sent(); - return [4 /*yield*/, browser.close()]; - case 6: - _a.sent(); - $ = cheerio_1.default.load(htmlContent); - articleBlocks = $(".article_block"); - jsonResponse = [ - $(articleBlocks[1]).find("span").attr("title").trim() || null, - $(articleBlocks[2]).find("span").attr("title").trim() || null, - $(articleBlocks[3]).find("span").attr("title").trim() || null, - $(articleBlocks[4]).find("span").attr("title").trim() || null, - ]; - return [2 /*return*/, jsonResponse]; - case 7: - err_1 = _a.sent(); - console.error("Error:", err_1); - return [2 /*return*/, undefined]; - case 8: return [2 /*return*/]; + url = "https://www.hidabroot.org/%D7%97%D7%93%D7%A9%D7%95%D7%AA-%D7%94%D7%99%D7%95%D7%9D"; + try { + return [2 /*return*/, fetch(url) + .then(function (response) { return response.text(); }) + .then(function (html) { + var _a; + var $ = cheerio_1.default.load(html); + var articleBlocks = $(".article_block"); + var bigArticleBlock = $(".article_block.mbl_big_article") + .eq(0) + .children() + .eq(1) + .children() + .eq(1) + .children() + .eq(0) + .text() || ""; + var bigArticleBlockID = Number($(".article_block.mbl_big_article") + .eq(0) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "")) || 0; + var firstArticleBlockID = Number($(".article_block") + .eq(1) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "")) || 0; + var secondArticleBlockID = Number($(".article_block") + .eq(2) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "")) || 0; + var thirdArticleBlockID = Number($(".article_block") + .eq(3) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "")) || 0; + var fourthArticleBlockID = Number($(".article_block") + .eq(4) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "")) || 0; + var jsonResponse = (_a = {}, + _a[bigArticleBlock] = bigArticleBlockID, + _a[$(articleBlocks[1]).find("span").attr("title").trim()] = firstArticleBlockID, + _a[$(articleBlocks[2]).find("span").attr("title").trim()] = secondArticleBlockID, + _a[$(articleBlocks[3]).find("span").attr("title").trim()] = thirdArticleBlockID, + _a[$(articleBlocks[4]).find("span").attr("title").trim()] = fourthArticleBlockID, + _a); + return jsonResponse; + }) + .catch(function (error) { + console.error("Error:", error); + return null; + })]; } + catch (err) { + console.error("Error:", err); + return [2 /*return*/, null]; + } + return [2 /*return*/]; }); }); } diff --git a/build/todayNews/index.js.map b/build/todayNews/index.js.map index d12c0e8..f7e7a04 100644 --- a/build/todayNews/index.js.map +++ b/build/todayNews/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/todayNews/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,oDAA8B;AAE9B;;;;GAIG;AACH,SAAsB,SAAS;;;;;;oBACvB,GAAG,GACP,mFAAmF,CAAC;;;;oBAGpE,qBAAM,mBAAS,CAAC,MAAM,CAAC;4BACrC,QAAQ,EAAE,KAAK;yBAChB,CAAC,EAAA;;oBAFI,OAAO,GAAG,SAEd;oBACW,qBAAM,OAAO,CAAC,OAAO,EAAE,EAAA;;oBAA9B,IAAI,GAAG,SAAuB;oBACpC,qBAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAA;;oBAApB,SAAoB,CAAC;oBACD,qBAAM,IAAI,CAAC,OAAO,EAAE,EAAA;;oBAAlC,WAAW,GAAG,SAAoB;oBACxC,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;oBAArB,SAAqB,CAAC;oBAEhB,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC9B,aAAa,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC;oBAEpC,YAAY,GAAG;wBACnB,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;wBAC7D,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;wBAC7D,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;wBAC7D,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;qBAC9D,CAAC;oBAEF,sBAAO,YAAY,EAAC;;;oBAEpB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAG,CAAC,CAAC;oBAC7B,sBAAO,SAAS,EAAC;;;;;CAEpB;AA5BD,8BA4BC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/todayNews/index.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..543f4ee --- /dev/null +++ b/package-lock.json @@ -0,0 +1,805 @@ +{ + "name": "hidabroot", + "version": "0.5.5-beta", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hidabroot", + "version": "0.5.5-beta", + "license": "MIT", + "dependencies": { + "cheerio": "^1.0.0-rc.12" + }, + "devDependencies": { + "@types/node": "^16.10.2", + "ts-node": "^10.2.1", + "tslint": "^6.1.3", + "typescript": "~4.4.3" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.22.10", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", + "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.22.10", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.22.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", + "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "16.18.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.41.tgz", + "integrity": "sha512-YZJjn+Aaw0xihnpdImxI22jqGbp0DCgTFKRycygjGx/Y27NnWFJa5FJ7P+MRT3u07dogEeMVh70pWpbIQollTA==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cheerio": { + "version": "1.0.0-rc.12", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", + "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "htmlparser2": "^8.0.1", + "parse5": "^7.0.0", + "parse5-htmlparser2-tree-adapter": "^7.0.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/htmlparser2": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", + "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "entities": "^4.4.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", + "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", + "dependencies": { + "domhandler": "^5.0.2", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", + "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tslint": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", + "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", + "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.3", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.13.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 4.0.0-dev" + } + }, + "node_modules/tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" + } + }, + "node_modules/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + } +} diff --git a/package.json b/package.json index 9e17259..127c791 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hidabroot", - "version": "0.5.5-beta", + "version": "0.6.0-beta", "description": "An unofficial API for hidabroot", "main": "build/index.js", "types": "build/index.d.ts", @@ -30,7 +30,6 @@ "node": ">=8" }, "dependencies": { - "cheerio": "^1.0.0-rc.12", - "puppeteer": "^20.9.0" + "cheerio": "^1.0.0-rc.12" } } diff --git a/src/getArticle/index.ts b/src/getArticle/index.ts new file mode 100644 index 0000000..3f410e9 --- /dev/null +++ b/src/getArticle/index.ts @@ -0,0 +1,36 @@ +import cheerio from "cheerio"; + +/** + * Get any article content by it's ID. + * + * @param {number} id The id of the article + */ +export async function getArticle(id: number): Promise { + const url = "https://www.hidabroot.org/article/" + id; + + try { + return fetch(url) + .then((response) => response.text()) + .then((html) => { + const $ = cheerio.load(html); + const header = $(".page\\_title.no\\_border").eq(0).text(); + let output: string | null = ""; + if (header == "דף שגיאה 404 - אבל יש לנו הצעות אחרות!...") { + output = null; + } else { + $('p[dir="RTL"]').each((index, p) => { + output += $(p).text(); + }); + } + + return output; + }) + .catch((error) => { + console.error("Error: " + error); + return null; + }); + } catch (err) { + console.error("Error:", err); + return null; + } +} diff --git a/src/index.ts b/src/index.ts index 83b77bb..f456184 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ -import { todayNews } from "./todayNews/index"; +import { todayNews } from "./todayNews"; +import { getArticle } from "./getArticle"; -export { todayNews }; +export { todayNews, getArticle }; diff --git a/src/todayNews/index.ts b/src/todayNews/index.ts index dfed1f3..83bd909 100644 --- a/src/todayNews/index.ts +++ b/src/todayNews/index.ts @@ -1,37 +1,112 @@ -import puppeteer from "puppeteer"; import cheerio from "cheerio"; /** * Retrieves the news titles from "Hadshot Hayom" and returns them in a JSON format. * - * @returns {Promise} An array of news titles extracted from the website or null if an error occurs. + * @returns {Promise<{ [key: string]: number }>} An array of news titles extracted from the website or null if an error occurs. */ -export async function todayNews(): Promise { +export async function todayNews(): Promise<{ [key: string]: number }> { const url = "https://www.hidabroot.org/%D7%97%D7%93%D7%A9%D7%95%D7%AA-%D7%94%D7%99%D7%95%D7%9D"; try { - const browser = await puppeteer.launch({ - headless: "new", - }); - const page = await browser.newPage(); - await page.goto(url); - const htmlContent = await page.content(); - await browser.close(); - - const $ = cheerio.load(htmlContent); - const articleBlocks = $(".article_block"); - - const jsonResponse = [ - $(articleBlocks[1]).find("span").attr("title").trim() || null, - $(articleBlocks[2]).find("span").attr("title").trim() || null, - $(articleBlocks[3]).find("span").attr("title").trim() || null, - $(articleBlocks[4]).find("span").attr("title").trim() || null, - ]; - - return jsonResponse; + return fetch(url) + .then((response) => response.text()) + .then((html) => { + const $ = cheerio.load(html); + const articleBlocks = $(".article_block"); + + const bigArticleBlock = + $(".article_block.mbl_big_article") + .eq(0) + .children() + .eq(1) + .children() + .eq(1) + .children() + .eq(0) + .text() || ""; + + const bigArticleBlockID = + Number( + $(".article_block.mbl_big_article") + .eq(0) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "") + ) || 0; + + const firstArticleBlockID = + Number( + $(".article_block") + .eq(1) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "") + ) || 0; + + const secondArticleBlockID = + Number( + $(".article_block") + .eq(2) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "") + ) || 0; + + const thirdArticleBlockID = + Number( + $(".article_block") + .eq(3) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "") + ) || 0; + + const fourthArticleBlockID = + Number( + $(".article_block") + .eq(4) + .children() + .eq(1) + .children() + .eq(1) + .attr("href") + .replace("https://www.hidabroot.org/article/", "") + ) || 0; + + const jsonResponse: { [key: string]: number } = { + [bigArticleBlock]: bigArticleBlockID, + [$(articleBlocks[1]).find("span").attr("title").trim()]: + firstArticleBlockID, + [$(articleBlocks[2]).find("span").attr("title").trim()]: + secondArticleBlockID, + [$(articleBlocks[3]).find("span").attr("title").trim()]: + thirdArticleBlockID, + [$(articleBlocks[4]).find("span").attr("title").trim()]: + fourthArticleBlockID, + }; + + return jsonResponse; + }) + .catch((error) => { + console.error("Error:", error); + return null; + }); } catch (err) { console.error("Error:", err); - return undefined; + return null; } } diff --git a/tests/test.js b/tests/test.js index 0c859a3..7b82cc4 100644 --- a/tests/test.js +++ b/tests/test.js @@ -1,4 +1,7 @@ -const Hidabroot = require("../build/index"); -Hidabroot.todayNews().then((response) => { - console.log(response); +const { todayNews, getArticle } = require("../build/index"); +todayNews().then((article) => { + const desiredKey = Object.keys(article)[0]; + getArticle(article[desiredKey]).then((articleContent) => { + console.log(articleContent); + }); });