md-y/mangadex-full-api

Manga.search() not working

Closed this issue · 3 comments

console.log(`Searching... (Query: ${query})`);
api.Manga.search(query).then((results) => {
    console.log(`Found: ${results}`);
}).catch((err) => {
    console.log(err);
});

Output:

Searching... (Query: Shield Hero)
Found:

Manual search on mangadex website returns 3 different mangas with the same query used as "Manga title".

I have the same problem

          await Mangadex.agent.login('my_login', 'my_pass', true)
          let manga = await Mangadex.Manga.search(querry)
          console.log(manga)

and the output is []

Problem seems to be within the getMatches function of utils.js
regex[i].exec(body)) doesnt return any results.

I successfully built a workaround to search for manga by using cheerio to parse the html and not relying on regex.

const $ = cheerio.load(body);
$(".manga_title").each(function() {
	let title = $( this ).text();
	let href = $( this ).attr("href");
	console.log("Found: " + title + " | href: " + href);
});

Obviously this only works for searching manga using quick_search and adds a dependency to the API.

md-y commented

Sorry for the late reply.

Many Mangadex pages now have more whitespaces in them that most Regex functions did not account for. I updated the functions for search() and fullSearch() among others in Version 3.6.0.