mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 17:53:24 +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}
|
// Example series path: /tv/watch-{slug}-{id}
|
||||||
let mediaId = targetMedia.path.split('-').pop()?.replace('/', '');
|
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: {
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
|
baseUrl: gomoviesBase,
|
||||||
});
|
});
|
||||||
|
|
||||||
const seasonsEl = load(seasons)('.ss-item');
|
const seasonsEl = load(seasons)('.ss-item');
|
||||||
|
@@ -15,16 +15,30 @@ export async function getEmbeds(
|
|||||||
let embeds = await Promise.all(
|
let embeds = await Promise.all(
|
||||||
embedProviders.map(async (provider) => {
|
embedProviders.map(async (provider) => {
|
||||||
if (!targetEpisode.url) throw new NotFoundError('Episode not found');
|
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,
|
baseUrl: kissasianBase,
|
||||||
query: {
|
headers: {
|
||||||
s: provider.id,
|
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 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');
|
if (!embedUrl) throw new Error('Embed not found');
|
||||||
|
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import type { CheerioAPI } from 'cheerio';
|
import type { CheerioAPI } from 'cheerio';
|
||||||
|
|
||||||
export async function getEpisodes(dramaPage: CheerioAPI) {
|
export function getEpisodes(dramaPage: CheerioAPI) {
|
||||||
const episodesEl = dramaPage('tbody tr:not(:first-child)');
|
const episodesEl = dramaPage('.episodeSub');
|
||||||
|
|
||||||
return episodesEl
|
return episodesEl
|
||||||
.toArray()
|
.toArray()
|
||||||
.map((ep) => {
|
.map((ep) => {
|
||||||
const number = dramaPage(ep).find('td.episodeSub a').text().split('Episode')[1]?.trim();
|
const number = dramaPage(ep).find('.episodeSub a').text().split('Episode')[1]?.trim();
|
||||||
const url = dramaPage(ep).find('td.episodeSub a').attr('href');
|
const url = dramaPage(ep).find('.episodeSub a').attr('href');
|
||||||
return { number, url };
|
return { number, url };
|
||||||
})
|
})
|
||||||
.filter((e) => !!e.url);
|
.filter((e) => !!e.url);
|
||||||
|
@@ -4,6 +4,7 @@ import { flags } from '@/main/targets';
|
|||||||
import { makeSourcerer } from '@/providers/base';
|
import { makeSourcerer } from '@/providers/base';
|
||||||
import { NotFoundError } from '@/utils/errors';
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
|
import { kissasianBase } from './common';
|
||||||
import { getEmbeds } from './getEmbeds';
|
import { getEmbeds } from './getEmbeds';
|
||||||
import { getEpisodes } from './getEpisodes';
|
import { getEpisodes } from './getEpisodes';
|
||||||
import { search } from './search';
|
import { search } from './search';
|
||||||
@@ -25,7 +26,9 @@ export const kissAsianScraper = makeSourcerer({
|
|||||||
|
|
||||||
ctx.progress(30);
|
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 dramaPage = load(drama);
|
||||||
|
|
||||||
@@ -50,11 +53,13 @@ export const kissAsianScraper = makeSourcerer({
|
|||||||
|
|
||||||
ctx.progress(30);
|
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 dramaPage = load(drama);
|
||||||
|
|
||||||
const episodes = await getEpisodes(dramaPage);
|
const episodes = getEpisodes(dramaPage);
|
||||||
|
|
||||||
const targetEpisode = episodes[0];
|
const targetEpisode = episodes[0];
|
||||||
if (!targetEpisode?.url) throw new NotFoundError('Episode not found');
|
if (!targetEpisode?.url) throw new NotFoundError('Episode not found');
|
||||||
|
Reference in New Issue
Block a user