Fix Goojara Scraping and Capitilization

This commit is contained in:
memecornucopia
2024-02-01 12:19:28 -05:00
parent 28b15e5a36
commit ccb029db1d
2 changed files with 5 additions and 18 deletions

View File

@@ -20,8 +20,8 @@ async function universalScraper(ctx: ShowScrapeContext | MovieScrapeContext): Pr
} }
export const goojaraScraper = makeSourcerer({ export const goojaraScraper = makeSourcerer({
id: 'goojara', id: 'Goojara',
name: 'goojara', name: 'Goojara',
rank: 225, rank: 225,
flags: [], flags: [],
scrapeShow: universalScraper, scrapeShow: universalScraper,

View File

@@ -49,7 +49,6 @@ export async function searchAndFindMedia(
}); });
const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year))); const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year)));
return result; return result;
} }
@@ -67,29 +66,17 @@ export async function scrapeIds(
baseUrl, baseUrl,
headers: headersData, headers: headersData,
method: 'GET', method: 'GET',
}); query: { s: media.season.number.toString() },
const $1 = load(data);
const dataId = $1('#seon').attr('data-id');
if (!dataId) throw new NotFoundError('Not found');
data = await ctx.fetcher<string>(`/xhrc.php`, {
baseUrl,
headers: headersData,
method: 'POST',
body: new URLSearchParams({ s: media.season.number.toString(), t: dataId }),
}); });
let episodeId = ''; let episodeId = '';
const $2 = load(data); const $2 = load(data);
$2('.seho').each((index, element) => { $2('.seho').each((_index: any, element: any) => {
// Extracting the episode number as a string // Extracting the episode number as a string
const episodeNumber = $2(element).find('.seep .sea').text().trim(); const episodeNumber = $2(element).find('.seep .sea').text().trim();
console.log(episodeNumber);
// Comparing with the desired episode number as a string // Comparing with the desired episode number as a string
if (parseInt(episodeNumber, 10) === media.episode.number) { if (parseInt(episodeNumber, 10) === media.episode.number) {
const href = $2(element).find('.snfo h1 a').attr('href'); const href = $2(element).find('.snfo h1 a').attr('href');