');
const indexB = html.indexOf('
', indexA);
const chapterText = html.substring(indexA, indexB);
return chapterText;
}
async searchNovels(
searchTerm: string,
page: number,
): Promise
{
let html;
if (this.id === 'ranobes-ru') {
html = await this.safeFecth(this.site + '/index.php?do=search', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Referer: this.site + '/',
},
method: 'POST',
body: new URLSearchParams({
do: 'search',
subaction: 'search',
search_start: page.toString(),
story: searchTerm,
}).toString(),
});
} else {
const link = `${this.site}/search/${searchTerm}/page/${page}`;
html = await this.safeFecth(link);
}
return this.parseNovels(html);
}
}
type ChapterEntry = {
id: number;
title: string;
date: string;
link: string;
};