fix ranks and feedback

This commit is contained in:
Jorrin
2024-01-05 21:23:32 +01:00
parent e210d39a39
commit 7e1c897e30
3 changed files with 6 additions and 17 deletions

View File

@@ -12,7 +12,7 @@ const referer = 'https://ridomovies.tv/';
export const closeLoadScraper = makeEmbed({ export const closeLoadScraper = makeEmbed({
id: 'closeload', id: 'closeload',
name: 'CloseLoad', name: 'CloseLoad',
rank: 501, rank: 106,
async scrape(ctx) { async scrape(ctx) {
const baseUrl = new URL(ctx.url).origin; const baseUrl = new URL(ctx.url).origin;

View File

@@ -1,6 +1,3 @@
import { load } from 'cheerio';
import { unpack } from 'unpacker';
import { flags } from '@/entrypoint/utils/targets'; import { flags } from '@/entrypoint/utils/targets';
import { NotFoundError } from '@/utils/errors'; import { NotFoundError } from '@/utils/errors';
@@ -11,24 +8,15 @@ const referer = 'https://ridomovies.tv/';
export const ridooScraper = makeEmbed({ export const ridooScraper = makeEmbed({
id: 'ridoo', id: 'ridoo',
name: 'Ridoo', name: 'Ridoo',
rank: 500, rank: 105,
async scrape(ctx) { async scrape(ctx) {
const res = await ctx.proxiedFetcher<string>(ctx.url, { const res = await ctx.proxiedFetcher<string>(ctx.url, {
headers: { headers: {
referer, referer,
}, },
}); });
const $ = load(res);
const evalCode = $('script')
.filter((_, el) => {
const script = $(el);
return (script.attr('type') === 'text/javascript' && script.html()?.includes('eval')) ?? false;
})
.html();
if (!evalCode) throw new Error("Couldn't find eval code");
const decoded = unpack(evalCode);
const regexPattern = /file:"([^"]+)"/g; const regexPattern = /file:"([^"]+)"/g;
const url = regexPattern.exec(decoded)?.[1]; const url = regexPattern.exec(res)?.[1];
if (!url) throw new NotFoundError('Unable to find source url'); if (!url) throw new NotFoundError('Unable to find source url');
return { return {

View File

@@ -16,10 +16,11 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
const searchResult = await ctx.proxiedFetcher<SearchResult>('/search', { const searchResult = await ctx.proxiedFetcher<SearchResult>('/search', {
baseUrl: ridoMoviesApiBase, baseUrl: ridoMoviesApiBase,
query: { query: {
q: encodeURIComponent(ctx.media.title), q: ctx.media.title,
}, },
}); });
const show = searchResult.data.items[0]; const show = searchResult.data.items[0];
if (!show) throw new NotFoundError('No watchable item found');
let iframeSourceUrl = `/${show.fullSlug}/videos`; let iframeSourceUrl = `/${show.fullSlug}/videos`;
@@ -67,7 +68,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
export const ridooMoviesScraper = makeSourcerer({ export const ridooMoviesScraper = makeSourcerer({
id: 'ridomovies', id: 'ridomovies',
name: 'RidoMovies', name: 'RidoMovies',
rank: 500, rank: 105,
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED],
scrapeMovie: universalScraper, scrapeMovie: universalScraper,
scrapeShow: universalScraper, scrapeShow: universalScraper,