New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kaguya-anime/parsers

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kaguya-anime/parsers - npm Package Compare versions

Comparing version 1.8.1 to 1.9.0

build/parsers/anime/marin.d.ts

2

build/parsers/index.d.ts

@@ -19,2 +19,3 @@ import AnimeA47Scraper from './anime/a47';

import NettruyenScraper from './manga/nt';
import AnimeMarinScraper from './anime/marin';
declare const parsers: {

@@ -34,2 +35,3 @@ readonly anime: {

readonly haho: typeof AnimeHahoScraper;
readonly marin: typeof AnimeMarinScraper;
};

@@ -36,0 +38,0 @@ readonly manga: {

@@ -21,2 +21,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

const nt_1 = tslib_1.__importDefault(require("./manga/nt"));
const marin_1 = tslib_1.__importDefault(require("./anime/marin"));
const parsers = {

@@ -36,2 +37,3 @@ anime: {

haho: haho_1.default,
marin: marin_1.default,
},

@@ -38,0 +40,0 @@ manga: {

154

build/utils/tmdb.js

@@ -13,26 +13,47 @@ Object.defineProperty(exports, "__esModule", { value: true });

},
timeout: 10000,
});
const search = (keyword, type) => tslib_1.__awaiter(this, void 0, void 0, function* () {
var _a;
const { data } = yield client.get(`/search/${type}`, {
params: { language: 'en-US', query: keyword, page: 1, include_adult: true },
});
if (!((_a = data === null || data === void 0 ? void 0 : data.results) === null || _a === void 0 ? void 0 : _a.length))
try {
const { data } = yield client.get(`/search/${type}`, {
params: {
language: 'en-US',
query: keyword,
page: 1,
include_adult: true,
},
});
if (!((_a = data === null || data === void 0 ? void 0 : data.results) === null || _a === void 0 ? void 0 : _a.length))
return null;
return data.results[0];
}
catch (err) {
return null;
return data.results[0];
}
});
exports.search = search;
const getTranslations = (media) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const type = media.format === anilist_1.MediaFormat.Movie ? 'movie' : 'tv';
const searchResult = yield (0, exports.search)(media.title.native || media.title.userPreferred, type);
if (!searchResult)
try {
const type = media.format === anilist_1.MediaFormat.Movie ? 'movie' : 'tv';
let tmdbId = yield (0, exports.getTMDBId)(media.id);
if (!tmdbId) {
const searchResult = yield (0, exports.search)(media.title.native || media.title.userPreferred, type);
if (!searchResult)
return [];
tmdbId = searchResult.id;
}
const { data } = yield client.get(`/${type}/${tmdbId}/translations`);
return data.translations.map((trans) => ({
locale: trans.iso_639_1,
description: trans.data.overview,
title: trans.data.title || trans.data.name,
mediaId: media.id,
mediaType: media.type,
}));
}
catch (err) {
console.log(err);
return [];
const { data } = yield client.get(`/${type}/${searchResult.id}/translations`);
return data.translations.map((trans) => ({
locale: trans.iso_639_1,
description: trans.data.overview,
title: trans.data.title || trans.data.name,
mediaId: media.id,
mediaType: media.type,
}));
}
});

@@ -42,11 +63,17 @@ exports.getTranslations = getTranslations;

var _b;
const { data } = yield axios_1.default.get(`https://api.themoviedb.org/3/tv/${tmdbId}/season/${seasonNumber}?api_key=${TMDB_KEY}`);
if (!((_b = data === null || data === void 0 ? void 0 : data.episodes) === null || _b === void 0 ? void 0 : _b.length))
try {
const { data } = yield client.get(`/tv/${tmdbId}/season/${seasonNumber}?api_key=${TMDB_KEY}`);
if (!((_b = data === null || data === void 0 ? void 0 : data.episodes) === null || _b === void 0 ? void 0 : _b.length))
return [];
return data.episodes.map((episode) => ({
title: episode.name,
description: episode.overview,
image: 'https://image.tmdb.org/t/p/w500' + episode.still_path,
episodeNumber: episode.episode_number,
}));
}
catch (err) {
console.log(err);
return [];
return data.episodes.map((episode) => ({
title: episode.name,
description: episode.overview,
image: 'https://image.tmdb.org/t/p/w500' + episode.still_path,
episodeNumber: episode.episode_number,
}));
}
});

@@ -56,44 +83,63 @@ exports.getEpisodes = getEpisodes;

var _c, _d;
const mapping = yield (0, mapping_1.default)(anilistId, 'anilist_id');
if (!mapping)
try {
const mapping = yield (0, mapping_1.default)(anilistId, 'anilist_id');
if (!mapping)
return null;
if (mapping.themoviedb_id)
return mapping.themoviedb_id;
if (!mapping.thetvdb_id)
return null;
const { data } = yield client.get(`/find/${mapping.thetvdb_id}?api_key=${TMDB_KEY}&external_source=tvdb_id`);
return (_d = (_c = data === null || data === void 0 ? void 0 : data.tv_results) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.id;
}
catch (err) {
console.log(err);
return null;
if (mapping.themoviedb_id)
return mapping.themoviedb_id;
if (!mapping.thetvdb_id)
return null;
const { data } = yield axios_1.default.get(`https://api.themoviedb.org/3/find/${mapping.thetvdb_id}?api_key=${TMDB_KEY}&external_source=tvdb_id`);
return (_d = (_c = data === null || data === void 0 ? void 0 : data.tv_results) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.id;
}
});
exports.getTMDBId = getTMDBId;
const getSeason = (tmdbId, mapAirDate) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const { data } = yield axios_1.default.get(`https://api.themoviedb.org/3/tv/${tmdbId}?api_key=${TMDB_KEY}`);
if (!(data === null || data === void 0 ? void 0 : data.seasons))
try {
const { data } = yield client.get(`/tv/${tmdbId}?api_key=${TMDB_KEY}`);
if (!(data === null || data === void 0 ? void 0 : data.seasons))
return null;
const filteredSeasons = data.seasons.filter((season) => (season === null || season === void 0 ? void 0 : season.season_number) > 0);
const sortedSeasons = filteredSeasons.sort((a, b) => {
const seasonAirDate = new Date(a.air_date);
const nextSeasonAirDate = new Date(b.air_date);
return nextSeasonAirDate.getTime() - seasonAirDate.getTime();
});
const season = sortedSeasons.find((season) => {
const seasonAirDate = new Date(season.air_date);
const matchAirDate = new Date(mapAirDate);
return seasonAirDate.getTime() <= matchAirDate.getTime();
});
return season;
}
catch (err) {
console.log(err);
return null;
const filteredSeasons = data.seasons.filter((season) => (season === null || season === void 0 ? void 0 : season.season_number) > 0);
const sortedSeasons = filteredSeasons.sort((a, b) => {
const seasonAirDate = new Date(a.air_date);
const nextSeasonAirDate = new Date(b.air_date);
return nextSeasonAirDate.getTime() - seasonAirDate.getTime();
});
const season = sortedSeasons.find((season) => {
const seasonAirDate = new Date(season.air_date);
const matchAirDate = new Date(mapAirDate);
return seasonAirDate.getTime() <= matchAirDate.getTime();
});
return season;
}
});
exports.getSeason = getSeason;
const getEpisodeInfo = (anilist) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const tmdbId = yield (0, exports.getTMDBId)(anilist.id);
const month = anilist.startDate.month.toString().padStart(2, '0');
const day = anilist.startDate.day.toString().padStart(2, '0');
const season = yield (0, exports.getSeason)(tmdbId, `${anilist.startDate.year}-${month}-${day}`);
console.log(season);
if (!(season === null || season === void 0 ? void 0 : season.season_number)) {
try {
const tmdbId = yield (0, exports.getTMDBId)(anilist.id);
if (!tmdbId)
return null;
const month = anilist.startDate.month.toString().padStart(2, '0');
const day = anilist.startDate.day.toString().padStart(2, '0');
const season = yield (0, exports.getSeason)(tmdbId, `${anilist.startDate.year}-${month}-${day}`);
if (!(season === null || season === void 0 ? void 0 : season.season_number)) {
return [];
}
const episodes = yield (0, exports.getEpisodes)(tmdbId, season === null || season === void 0 ? void 0 : season.season_number);
return episodes;
}
catch (err) {
console.log(err);
return [];
}
const episodes = yield (0, exports.getEpisodes)(tmdbId, season === null || season === void 0 ? void 0 : season.season_number);
return episodes;
});
exports.getEpisodeInfo = getEpisodeInfo;
//# sourceMappingURL=tmdb.js.map
{
"name": "@kaguya-anime/parsers",
"version": "1.8.1",
"version": "1.9.0",
"main": "build/index.js",

@@ -10,3 +10,3 @@ "license": "MIT",

"dependencies": {
"@consumet/extensions": "^1.3.5",
"@consumet/extensions": "^1.4.14",
"axios": "^1.2.5",

@@ -44,3 +44,3 @@ "axios-cookiejar-support": "^4.0.6",

},
"gitHead": "cb1855144ae893e15c6755df2b64fece9b0ad8b2"
"gitHead": "bc43fb2126ae60a8d111062ab672ed3adb519ce4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc