mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
Attempt to fix kissasian
This commit is contained in:
@@ -43,10 +43,11 @@ export const goMoviesScraper = makeSourcerer({
|
||||
// Example series path: /tv/watch-{slug}-{id}
|
||||
let mediaId = targetMedia.path.split('-').pop()?.replace('/', '');
|
||||
|
||||
const seasons = await ctx.proxiedFetcher<any>(`${gomoviesBase}/ajax/v2/tv/seasons/${mediaId}`, {
|
||||
const seasons = await ctx.proxiedFetcher<string>(`/ajax/v2/tv/seasons/${mediaId}`, {
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
baseUrl: gomoviesBase,
|
||||
});
|
||||
|
||||
const seasonsEl = load(seasons)('.ss-item');
|
||||
|
@@ -15,16 +15,30 @@ export async function getEmbeds(
|
||||
let embeds = await Promise.all(
|
||||
embedProviders.map(async (provider) => {
|
||||
if (!targetEpisode.url) throw new NotFoundError('Episode not found');
|
||||
const watch = await ctx.proxiedFetcher<any>(targetEpisode.url, {
|
||||
const watch = await ctx.proxiedFetcher<string>(`${targetEpisode.url}&s=${provider.id}`, {
|
||||
baseUrl: kissasianBase,
|
||||
query: {
|
||||
s: provider.id,
|
||||
headers: {
|
||||
accept:
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
'cache-control': 'no-cache',
|
||||
pragma: 'no-cache',
|
||||
'sec-ch-ua': '"Not)A;Brand";v="24", "Chromium";v="116"',
|
||||
'sec-ch-ua-mobile': '?0',
|
||||
'sec-ch-ua-platform': '"macOS"',
|
||||
'sec-fetch-dest': 'document',
|
||||
'sec-fetch-mode': 'navigate',
|
||||
'sec-fetch-site': 'cross-site',
|
||||
'sec-fetch-user': '?1',
|
||||
'upgrade-insecure-requests': '1',
|
||||
cookie:
|
||||
'__rd=; ASP.NET_SessionId=jwnl2kmlw5h4mfdaxvpk30q0; k_token=OKbJDFNx3rUtaw7iAA6UxMKSJb79lgZ2X2rVC9aupJhycYQKVSLaW1y2B4K%2f%2fo3i6BuzhXgfkJGmKlKH6LpNlKPPpZUk31n9DapfMdJgjlLExgrPS3jpSKwGnNUI%2bOpNpZu9%2fFnkLZRxvVKCa8APMxrck1tYkKXWqfyJJh8%2b7hQTI1wfAOU%2fLEouHhtQGL%2fReTzElw2LQ0XSL1pjs%2fkWW3rM3of2je7Oo13I%2f7olLFuiJUVWyNbn%2fYKSgNrm%2bQ3p',
|
||||
},
|
||||
});
|
||||
|
||||
const watchPage = load(watch);
|
||||
|
||||
const embedUrl = watchPage('iframe[id=my_video_1]').attr('src');
|
||||
const embedUrl = watchPage('#my_video_1').attr('src');
|
||||
|
||||
if (!embedUrl) throw new Error('Embed not found');
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import type { CheerioAPI } from 'cheerio';
|
||||
|
||||
export async function getEpisodes(dramaPage: CheerioAPI) {
|
||||
const episodesEl = dramaPage('tbody tr:not(:first-child)');
|
||||
export function getEpisodes(dramaPage: CheerioAPI) {
|
||||
const episodesEl = dramaPage('.episodeSub');
|
||||
|
||||
return episodesEl
|
||||
.toArray()
|
||||
.map((ep) => {
|
||||
const number = dramaPage(ep).find('td.episodeSub a').text().split('Episode')[1]?.trim();
|
||||
const url = dramaPage(ep).find('td.episodeSub a').attr('href');
|
||||
const number = dramaPage(ep).find('.episodeSub a').text().split('Episode')[1]?.trim();
|
||||
const url = dramaPage(ep).find('.episodeSub a').attr('href');
|
||||
return { number, url };
|
||||
})
|
||||
.filter((e) => !!e.url);
|
||||
|
@@ -4,6 +4,7 @@ import { flags } from '@/main/targets';
|
||||
import { makeSourcerer } from '@/providers/base';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { kissasianBase } from './common';
|
||||
import { getEmbeds } from './getEmbeds';
|
||||
import { getEpisodes } from './getEpisodes';
|
||||
import { search } from './search';
|
||||
@@ -25,7 +26,9 @@ export const kissAsianScraper = makeSourcerer({
|
||||
|
||||
ctx.progress(30);
|
||||
|
||||
const drama = await ctx.proxiedFetcher<string>(targetDrama.url);
|
||||
const drama = await ctx.proxiedFetcher<string>(targetDrama.url, {
|
||||
baseUrl: kissasianBase,
|
||||
});
|
||||
|
||||
const dramaPage = load(drama);
|
||||
|
||||
@@ -50,11 +53,13 @@ export const kissAsianScraper = makeSourcerer({
|
||||
|
||||
ctx.progress(30);
|
||||
|
||||
const drama = await ctx.proxiedFetcher<string>(targetDrama.url);
|
||||
const drama = await ctx.proxiedFetcher<string>(targetDrama.url, {
|
||||
baseUrl: kissasianBase,
|
||||
});
|
||||
|
||||
const dramaPage = load(drama);
|
||||
|
||||
const episodes = await getEpisodes(dramaPage);
|
||||
const episodes = getEpisodes(dramaPage);
|
||||
|
||||
const targetEpisode = episodes[0];
|
||||
if (!targetEpisode?.url) throw new NotFoundError('Episode not found');
|
||||
|
Reference in New Issue
Block a user