diff --git a/package-lock.json b/package-lock.json index b8c3c63..82fe005 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,16 +12,61 @@ "regenerator-runtime": "^0.13.4" } }, + "@sindresorhus/is": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-2.1.1.tgz", + "integrity": "sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg==" + }, + "@szmarczak/http-timer": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz", + "integrity": "sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ==", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, + "@types/cacheable-request": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz", + "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, "@types/debug": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-0.0.31.tgz", "integrity": "sha512-LS1MCPaQKqspg7FvexuhmDbWUhE2yIJ+4AgVIyObfc06/UKZ8REgxGNjZc82wPLWmbeOm7S+gSsLgo75TanG4A==" }, + "@types/http-cache-semantics": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", + "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==" + }, + "@types/keyv": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz", + "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==", + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "13.7.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.1.tgz", "integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA==" }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -156,6 +201,25 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, + "cacheable-lookup": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz", + "integrity": "sha512-W+JBqF9SWe18A72XFzN/V/CULFzPm7sBXzzR6ekkE+3tLG72wFZrBiBZhrZuDoYexop4PHJVdFAKb/Nj9+tm9w==" + }, + "cacheable-request": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.1.tgz", + "integrity": "sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^2.0.0" + } + }, "camelize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", @@ -184,6 +248,14 @@ "resolved": "https://registry.npmjs.org/cheerio-tableparser/-/cheerio-tableparser-1.0.1.tgz", "integrity": "sha1-5VrS3LU2G4wyOmy7jAzUbjy98c0=" }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + } + }, "cloudscraper": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/cloudscraper/-/cloudscraper-4.6.0.tgz", @@ -311,6 +383,26 @@ "ms": "2.0.0" } }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + } + } + }, + "defer-to-connect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", + "integrity": "sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -386,6 +478,14 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", @@ -555,6 +655,14 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -563,6 +671,25 @@ "assert-plus": "^1.0.0" } }, + "got": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/got/-/got-11.2.0.tgz", + "integrity": "sha512-68pBow9XXXSdVRV5wSx0kWMCZsag4xE3Ru0URVe0PWsSYmU4SJrUmEO6EVYFlFHc9rq/6Yqn6o1GxIb9torQxg==", + "requires": { + "@sindresorhus/is": "^2.1.1", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.1", + "decompress-response": "^6.0.0", + "get-stream": "^5.1.0", + "http2-wrapper": "^1.0.0-beta.4.5", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -670,6 +797,11 @@ "readable-stream": "^3.1.1" } }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" + }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -692,6 +824,15 @@ "sshpk": "^1.7.0" } }, + "http2-wrapper": { + "version": "1.0.0-beta.4.6", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.0-beta.4.6.tgz", + "integrity": "sha512-9oB4BiGDTI1FmIBlOF9OJ5hwJvcBEmPCqk/hy314Uhy2uq5TjekUZM8w8SPLLlUEM+mxNhXdPAXfrJN2Zbb/GQ==", + "requires": { + "quick-lru": "^5.0.0", + "resolve-alpn": "^1.0.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -755,6 +896,11 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -781,11 +927,24 @@ "verror": "1.10.0" } }, + "keyv": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz", + "integrity": "sha512-xz6Jv6oNkbhrFCvCP7HQa8AaII8y8LRpoSm661NOKLr4uHuBwhX4epXrPQgF3+xdJnN4Esm5X0xwY4bOlALOtw==", + "requires": { + "json-buffer": "3.0.1" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -819,6 +978,11 @@ "mime-db": "1.43.0" } }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -864,6 +1028,11 @@ "he": "1.1.1" } }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + }, "npm": { "version": "6.14.5", "resolved": "https://registry.npmjs.org/npm/-/npm-6.14.5.tgz", @@ -3996,6 +4165,19 @@ "ee-first": "1.1.1" } }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.0.0.tgz", + "integrity": "sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg==" + }, "parse5": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", @@ -4033,6 +4215,15 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -4043,6 +4234,11 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -4132,6 +4328,19 @@ "lodash": "^4.17.15" } }, + "resolve-alpn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.0.0.tgz", + "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA==" + }, + "responselike": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz", + "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==", + "requires": { + "lowercase-keys": "^2.0.0" + } + }, "rss-to-json": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/rss-to-json/-/rss-to-json-1.1.1.tgz", @@ -4337,6 +4546,11 @@ "extsprintf": "^1.2.0" } }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, "x-xss-protection": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz", @@ -4351,6 +4565,15 @@ "joi": "^13.1.2", "node-expat": "^2.3.18" } + }, + "youtube-search-without-api-key": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/youtube-search-without-api-key/-/youtube-search-without-api-key-1.0.2.tgz", + "integrity": "sha512-WAQZYBmgarclZCvptB9HnPA9lbTA5b08Q0Qj+l/92PNilZltcCF6fwC1LUFZxEQ40Mc88zOJrivlReR9SHcLHw==", + "requires": { + "cheerio": "^1.0.0-rc.3", + "got": "^11.1.2" + } } } } diff --git a/src/api/api.js b/src/api/api.js index 3ce4179..9462ebd 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -300,37 +300,81 @@ const getMoreInfo = async (title) =>{ const promises = [] let animeTitle ="" let animeId = "" + let animeType = "" await animeflv.searchAnime(title).then(data => { data.forEach(function (anime) { - if (anime.label === title) { - animeTitle = anime.label + if (anime.label.split('\t')[0] === title.split('\t')[0] || anime.label === `${title} (TV)`) { + if (anime.label.includes('(TV)', 0)) { animeTitle = anime.label.split('\t')[0].replace(' (TV)', '') } + else { animeTitle = anime.label.split('\t')[0] } animeId = anime.animeId + animeType = anime.type.toLowerCase() } } ) }); try{ - promises.push(await animeflvInfo(animeId).then(async extra => ({ - title: animeTitle || null, - poster: await imageUrlToBase64(extra.animeExtraInfo[0].poster) || null, - synopsis: extra.animeExtraInfo[0].synopsis || null, - status: extra.animeExtraInfo[0].debut || null, - type: extra.animeExtraInfo[0].type || null, - rating: extra.animeExtraInfo[0].rating || null, - genres: extra.genres || null, - episodes: extra.listByEps || null, - moreInfo: await animeExtraInfo(title).then(info =>{ - return info || null - }), - promo: await getAnimeVideoPromo(title).then(promo =>{ - return promo || null - }), - characters: await getAnimeCharacters(animeTitle).then(characters =>{ - return characters || null - }) - }))); + + switch (animeType) { + + case "anime": + promises.push(await animeflvInfo(animeId).then(async extra => ({ + title: animeTitle || null, + poster: await imageUrlToBase64(extra.animeExtraInfo[0].poster) || null, + synopsis: extra.animeExtraInfo[0].synopsis || null, + status: extra.animeExtraInfo[0].debut || null, + type: extra.animeExtraInfo[0].type || null, + rating: extra.animeExtraInfo[0].rating || null, + genres: extra.genres || null, + episodes: extra.listByEps || null, + moreInfo: await animeExtraInfo(title).then(info =>{ + return info || null + }), + promo: await getAnimeVideoPromo(title).then(promo =>{ + return promo || null + }), + characters: await getAnimeCharacters(animeTitle).then(characters =>{ + return characters || null + }) + }))); + break; + case "pelĂ­cula": + promises.push(await animeflvInfo(animeId).then(async extra => ({ + title: animeTitle || null, + poster: await imageUrlToBase64(extra.animeExtraInfo[0].poster) || null, + synopsis: extra.animeExtraInfo[0].synopsis || null, + status: extra.animeExtraInfo[0].debut || null, + type: extra.animeExtraInfo[0].type || null, + rating: extra.animeExtraInfo[0].rating || null, + genres: extra.genres || null, + episodes: extra.listByEps || null, + }))); + break; + case "ova": + promises.push(await animeflvInfo(animeId).then(async extra => ({ + title: animeTitle || null, + poster: await imageUrlToBase64(extra.animeExtraInfo[0].poster) || null, + synopsis: extra.animeExtraInfo[0].synopsis || null, + status: extra.animeExtraInfo[0].debut || null, + type: extra.animeExtraInfo[0].type || null, + rating: extra.animeExtraInfo[0].rating || null, + genres: extra.genres || null, + episodes: extra.listByEps || null, + }))); + break; + default: + promises.push(await animeflvInfo(animeId).then(async extra => ({ + title: animeTitle || null, + poster: await imageUrlToBase64(extra.animeExtraInfo[0].poster) || null, + synopsis: extra.animeExtraInfo[0].synopsis || null, + status: extra.animeExtraInfo[0].debut || null, + type: extra.animeExtraInfo[0].type || null, + rating: extra.animeExtraInfo[0].rating || null, + genres: extra.genres || null, + episodes: extra.listByEps || null, + }))); + } }catch(err){ console.log(err) diff --git a/src/utils/index.js b/src/utils/index.js index df1f11e..0db4d1b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -236,6 +236,7 @@ const animeExtraInfo = async(title) =>{ }; const imageUrlToBase64 = async(url) => { + Buffer.clear return await base64.encode(url, {string:true}); }; @@ -253,10 +254,12 @@ const searchAnime = async(query) => { const id = $element.find('div.Description a.Button').attr('href').slice(1); const title = $element.find('a h3').text(); let poster = $element.find('a div.Image figure img').attr('src') || $element.find('a div.Image figure img').attr('data-cfsrc'); + const type = $element.find('div.Description p span.Type').text(); promises.push(search().then(async extra => ({ id: id || null, title: title || null, + type: type || null, image: await imageUrlToBase64(poster) || null }))); @@ -272,19 +275,22 @@ const transformUrlServer = async(urlReal) =>{ let body const promises = [] - for(i = 0; i< urlReal.length -1; i++){ + for(i = 0; i <= urlReal.length -1; i++){ switch (urlReal[i].server) { case "amus": // Izanagi res = await cloudscraper(urlReal[i].code.replace("embed","check")); body = await res; urlReal[i].code = JSON.parse(body).file + urlReal[i].direct = true break; case "natsuki": // Natsuki res = await cloudscraper(urlReal[i].code.replace("embed","check")); body = await res; urlReal[i].code = JSON.parse(body).file + urlReal[i].direct = true break; default: + urlReal[i].direct = false break; } } @@ -292,7 +298,8 @@ const transformUrlServer = async(urlReal) =>{ urlReal.map(doc =>{ promises.push({ id: doc.title.toLowerCase(), - url: doc.code + url: doc.code, + direct: doc.direct }); });