Update ashi/ashi.js

This commit is contained in:
aka paul 2025-12-28 14:04:15 +00:00
parent 739a503c60
commit 3e98c074da

View file

@ -140,8 +140,8 @@ async function searchResults(query) {
};
const animekaiSearch = async () => {
const searchBaseUrl = "https://animekai.to/browser?keyword=";
const baseUrl = "https://animekai.to";
const searchBaseUrl = "https://anikai.to/browser?keyword=";
const baseUrl = "https://anikai.to";
const posterHrefRegex = /href="[^"]*" class="poster"/g;
const titleRegex = /class="title"[^>]*title="[^"]*"/g;
@ -187,7 +187,7 @@ async function searchResults(query) {
`${searchBaseUrl}${encodedQuery}&page=3`
];
const responses = await Promise.all(urls.map(url => fetchv2(url)));
const responses = await Promise.all(urls.map(url => fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url))));
const htmlTexts = await Promise.all(responses.map(res => res.text()));
const allResults = [];
@ -234,7 +234,7 @@ async function searchResults(query) {
`${searchBaseUrl}${encodedQuery}&page=3`
];
const responses = await Promise.all(urls.map(url => fetchv2(url)));
const responses = await Promise.all(urls.map(url => fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url))));
const htmlTexts = await Promise.all(responses.map(res => res.text()));
const allResults = [];
@ -284,7 +284,7 @@ async function extractDetails(url) {
const actualUrl = url.replace("Animekai:", "").trim();
try {
const response = await fetchv2(actualUrl);
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(actualUrl));
const htmlText = await response.text();
const descriptionMatch = (/<div class="desc text-expand">([\s\S]*?)<\/div>/.exec(htmlText) || [])[1];
@ -305,7 +305,7 @@ async function extractDetails(url) {
}
} else {
try {
const response = await fetchv2(url);
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url));
const htmlText = await response.text();
const descriptionMatch = (/<div class="description text-expand">([\s\S]*?)<\/div>/.exec(htmlText) || [])[1];
@ -332,7 +332,7 @@ async function extractEpisodes(url) {
try {
if (url.startsWith("Animekai:")) {
const actualUrl = url.replace("Animekai:", "").trim();
const htmlText = await (await fetchv2(actualUrl)).text();
const htmlText = await (await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(actualUrl))).text();
const animeIdMatch = (htmlText.match(/<div class="rate-box"[^>]*data-id="([^"]+)"/) || [])[1];
if (!animeIdMatch) return JSON.stringify([{ error: "AniID not found" }]);
@ -340,8 +340,8 @@ async function extractEpisodes(url) {
const tokenData = await tokenResponse.json();
const token = tokenData.result;
const episodeListUrl = `https://animekai.to/ajax/episodes/list?ani_id=${animeIdMatch}&_=${token}`;
const episodeListData = await (await fetchv2(episodeListUrl)).json();
const episodeListUrl = `https://anikai.to/ajax/episodes/list?ani_id=${animeIdMatch}&_=${token}`;
const episodeListData = await (await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(episodeListUrl))).json();
const cleanedHtml = cleanJsonHtml(episodeListData.result);
const episodeRegex = /<a[^>]+num="([^"]+)"[^>]+token="([^"]+)"[^>]*>/g;
@ -349,12 +349,12 @@ async function extractEpisodes(url) {
const episodes = episodeMatches.map(([_, episodeNum, episodeToken]) => ({
number: parseInt(episodeNum, 10),
href: `Animekai:https://animekai.to/ajax/links/list?token=${episodeToken}&_=ENCRYPT_ME`
href: `Animekai:https://anikai.to/ajax/links/list?token=${episodeToken}&_=ENCRYPT_ME`
}));
return JSON.stringify(episodes);
} else {
const htmlText = await (await fetchv2(url)).text();
const htmlText = await (await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url))).text();
const movieIDMatch = (htmlText.match(/<div class="detail-lower"[^>]*id="movie-rating"[^>]*data-id="([^"]+)"/) || [])[1];
if (!movieIDMatch) return JSON.stringify([{ error: "MovieID not found" }]);
@ -363,7 +363,7 @@ async function extractEpisodes(url) {
const token = temp.result;
const episodeListUrl = `https://1movies.bz/ajax/episodes/list?id=${movieIDMatch}&_=${token}`;
const episodeListData = await (await fetchv2(episodeListUrl)).json();
const episodeListData = await (await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(episodeListUrl))).json();
const cleanedHtml = cleanJsonHtml(episodeListData.result);
const episodeRegex = /<a[^>]+eid="([^"]+)"[^>]+num="([^"]+)"[^>]*>/g;
@ -407,7 +407,7 @@ async function extractStreamUrl(url) {
actualUrl = actualUrl.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
}
const response = await fetchv2(actualUrl);
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(actualUrl));
const text = await response.text();
const cleanedHtml = cleanJsonHtml(text);
const subRegex = /<div class="server-items lang-group" data-id="sub"[^>]*>([\s\S]*?)<\/div>/;
@ -446,7 +446,7 @@ async function extractStreamUrl(url) {
};
return {
type: result.name,
url: `https://animekai.to/ajax/links/view?id=${serverIdMap[result.name]}&_=${result.data}`
url: `https://anikai.to/ajax/links/view?id=${serverIdMap[result.name]}&_=${result.data}`
};
});
@ -454,7 +454,7 @@ async function extractStreamUrl(url) {
const streamResponses = await Promise.all(
streamUrls.map(async ({ type, url }) => {
try {
const res = await fetchv2(url);
const res = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url));
const json = await res.json();
return {
type: type,
@ -510,7 +510,7 @@ async function extractStreamUrl(url) {
const decryptedRaw = decryptedUrls.Softsub;
const headers = {
"Referer": "https://animekai.to/",
"Referer": "https://anikai.to/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
};
@ -575,7 +575,7 @@ async function extractStreamUrl(url) {
actualUrl = actualUrl.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
}
const response = await fetchv2(actualUrl);
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(actualUrl));
const responseData = await response.json();
const cleanedHtml = cleanJsonHtml(responseData.result);
@ -606,7 +606,7 @@ async function extractStreamUrl(url) {
}
const streamUrl = `https://1movies.bz/ajax/links/view?id=${serverId}&_=${token}`;
const streamResponse = await fetchv2(streamUrl);
const streamResponse = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(streamUrl));
const streamData = await streamResponse.json();
if (!streamData.result) {