Closed xaxa-0x3F closed 3 years ago
Hello Asuna :wave:
Seems like you get disableEpisodeFetch
error when you don't pass options
object or don't pass options
object with episode related properties
You can fix this by providing a object as options
with episode related properties
#1 - Not getting any episode information (disableEpisodeFetch: true)
const Anime = require("ctk-anime-scraper");
Anime.fetchAnime("https://gogoanime.ai//category/kimetsu-no-yaiba", {
disableEpisodeFetch: true
}).then(console.log);
#2 - Only getting first or certain episode information (episode: 1)
const Anime = require("ctk-anime-scraper");
Anime.fetchAnime("https://gogoanime.ai//category/kimetsu-no-yaiba", {
episode: 1
}).then(console.log);
#3 - Using mass_episodes
property for getting multiple episodes (mass_episodes: 5)
const Anime = require("ctk-anime-scraper");
Anime.fetchAnime("https://gogoanime.ai//category/kimetsu-no-yaiba", {
mass_episodes: 5
}).then(console.log);
If you are confused about how to implement disabling episodes fetch in your code, then (changed some code):
const animeapi = require('ctk-anime-scraper');
const { MessageEmbed, MessageAttachment, MessageCollector } = require('discord.js');
const name = message.content.match(/(?:"[^"]*"|^[^"]*$)/)[0].replace(/"/g, "");
name.replace(" ", "-");
// const ep = message.content.match(/^\d+|\d+\b|\d+(?=\w)/g)[0];
const link = await animeapi.search(name).then((data) => {
if (!data.length) return console.log("No Anime with this name found");
console.log(data[0].link);
animeapi.fetchAnime(data[0].link, {
disableEpisodeFetch: true
}).then(data => console.log(data))
});
Thank you so much @LegendaryEmoji
My code: