Update hianime/hianime.js
This commit is contained in:
+7
-7
@@ -2,7 +2,7 @@ async function searchResults(keyword) {
|
|||||||
const results = [];
|
const results = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetchv2("https://hianime.to/search?keyword=" + encodeURIComponent(keyword));
|
const response = await fetchv2("https://aniwatchtv.to/search?keyword=" + encodeURIComponent(keyword));
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
const blocks = html.split('<div class="flw-item">').slice(1);
|
const blocks = html.split('<div class="flw-item">').slice(1);
|
||||||
@@ -33,7 +33,7 @@ async function searchResults(keyword) {
|
|||||||
|
|
||||||
async function extractDetails(url) {
|
async function extractDetails(url) {
|
||||||
try {
|
try {
|
||||||
const response = await fetchv2("https://hianime.to" + url);
|
const response = await fetchv2("https://aniwatchtv.to" + url);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
const descMatch = html.match(/<div class="film-description m-hide">[\s\S]*?<div class="text">\s*([\s\S]*?)\s*<\/div>/);
|
const descMatch = html.match(/<div class="film-description m-hide">[\s\S]*?<div class="text">\s*([\s\S]*?)\s*<\/div>/);
|
||||||
@@ -65,13 +65,13 @@ async function extractEpisodes(url) {
|
|||||||
watchUrl = watchUrl.replace(/\/([^\/]+)$/, '/watch/$1');
|
watchUrl = watchUrl.replace(/\/([^\/]+)$/, '/watch/$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
const watchResp = await fetchv2("https://hianime.to" + watchUrl);
|
const watchResp = await fetchv2("https://aniwatchtv.to" + watchUrl);
|
||||||
const watchHtml = await watchResp.text();
|
const watchHtml = await watchResp.text();
|
||||||
const idMatch = watchHtml.match(/<div[^>]+id="wrapper"[^>]+data-id="(\d+)"[^>]*>/);
|
const idMatch = watchHtml.match(/<div[^>]+id="wrapper"[^>]+data-id="(\d+)"[^>]*>/);
|
||||||
if (!idMatch) throw new Error("movie_id not found");
|
if (!idMatch) throw new Error("movie_id not found");
|
||||||
const movieId = idMatch[1];
|
const movieId = idMatch[1];
|
||||||
|
|
||||||
const epListResp = await fetchv2(`https://hianime.to/ajax/v2/episode/list/${movieId}`);
|
const epListResp = await fetchv2(`https://aniwatchtv.to/ajax/v2/episode/list/${movieId}`);
|
||||||
const epListJson = await epListResp.json();
|
const epListJson = await epListResp.json();
|
||||||
const epHtml = epListJson.html;
|
const epHtml = epListJson.html;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ async function extractEpisodes(url) {
|
|||||||
|
|
||||||
async function extractStreamUrl(ID) {
|
async function extractStreamUrl(ID) {
|
||||||
try {
|
try {
|
||||||
const serversResp = await fetchv2(`https://hianime.to/ajax/v2/episode/servers?episodeId=${ID}`);
|
const serversResp = await fetchv2(`https://aniwatchtv.to/ajax/v2/episode/servers?episodeId=${ID}`);
|
||||||
const serversJson = await serversResp.json();
|
const serversJson = await serversResp.json();
|
||||||
const serversHtml = serversJson.html;
|
const serversHtml = serversJson.html;
|
||||||
|
|
||||||
@@ -110,12 +110,12 @@ async function extractStreamUrl(ID) {
|
|||||||
const headers = {
|
const headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0",
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0",
|
||||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
"Referer": "https://hianime.to/"
|
"Referer": "https://aniwatchtv.to/"
|
||||||
};
|
};
|
||||||
|
|
||||||
const processServer = async (serverId, title) => {
|
const processServer = async (serverId, title) => {
|
||||||
try {
|
try {
|
||||||
const sourcesResp = await fetchv2(`https://hianime.to/ajax/v2/episode/sources?id=${serverId}`);
|
const sourcesResp = await fetchv2(`https://aniwatchtv.to/ajax/v2/episode/sources?id=${serverId}`);
|
||||||
const sourcesJson = await sourcesResp.json();
|
const sourcesJson = await sourcesResp.json();
|
||||||
const iframeUrl = sourcesJson.link;
|
const iframeUrl = sourcesJson.link;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user