refactor: Remove Anify and Consumet integrations, their dependencies, and the ipCheck script.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
import { ANIME, META } from "@consumet/extensions";
|
||||
import fetchAdapter from "@haverstack/axios-fetch-adapter";
|
||||
|
||||
const gogoAnime = new ANIME.Gogoanime(undefined, undefined, fetchAdapter);
|
||||
export const aniList = new META.Anilist(gogoAnime, undefined, fetchAdapter);
|
||||
@@ -1,64 +0,0 @@
|
||||
import { sortByProperty } from "~/libs/sortByProperty";
|
||||
import type { FetchUrlResponse } from "~/types/episode/fetch-url-response";
|
||||
|
||||
import { type SkipTime, convertSkipTime } from "./convertSkipTime";
|
||||
import {
|
||||
audioPriority,
|
||||
qualityPriority,
|
||||
subtitlesPriority,
|
||||
} from "./priorities";
|
||||
|
||||
export async function getSourcesFromAnify(
|
||||
provider: string,
|
||||
watchId: string,
|
||||
aniListId: number,
|
||||
): Promise<FetchUrlResponse | null> {
|
||||
const response = await fetch("https://anify.eltik.cc/sources", {
|
||||
body: JSON.stringify({
|
||||
watchId,
|
||||
providerId: provider,
|
||||
episodeNumber: "1",
|
||||
id: aniListId.toString(),
|
||||
subType: "sub",
|
||||
}),
|
||||
method: "POST",
|
||||
}).then((res) => res.json() as Promise<AnifySourcesResponse>);
|
||||
const { sources, subtitles, audio, intro, outro, headers } = response;
|
||||
|
||||
if (!sources || sources.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const source = sources.sort(sortByProperty(qualityPriority, "quality"))[0]
|
||||
?.url;
|
||||
subtitles?.sort(sortByProperty(subtitlesPriority, "lang"));
|
||||
audio?.sort(sortByProperty(audioPriority, "lang"));
|
||||
|
||||
return {
|
||||
source,
|
||||
audio,
|
||||
subtitles,
|
||||
intro: convertSkipTime(intro),
|
||||
outro: convertSkipTime(outro),
|
||||
headers: Object.keys(headers ?? {}).length > 0 ? headers : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
interface AnifySourcesResponse {
|
||||
sources: VideoSource[];
|
||||
subtitles: LanguageSource[];
|
||||
audio: LanguageSource[];
|
||||
intro: SkipTime;
|
||||
outro: SkipTime;
|
||||
headers?: Record<string, string>;
|
||||
}
|
||||
|
||||
interface VideoSource {
|
||||
url: string;
|
||||
quality: string;
|
||||
}
|
||||
|
||||
interface LanguageSource {
|
||||
url: string;
|
||||
lang: string;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
||||
import { DurableObject } from "cloudflare:workers";
|
||||
import { print } from "graphql";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// import { GraphQLClient } from "graphql-request";
|
||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
||||
import nodeFetch from "node-fetch";
|
||||
|
||||
// import { GetTitleQuery } from "../libs/anilist/getTitle.ts";
|
||||
|
||||
const agent = new HttpsProxyAgent(
|
||||
"http://ruru:pdh!CQB@kpc3vyb3cwc@45.56.108.251:3128",
|
||||
);
|
||||
const response = await nodeFetch("https://httpbin.org/ip", { agent });
|
||||
console.log(await response.text());
|
||||
console.log(response.status);
|
||||
console.log(nodeFetch);
|
||||
|
||||
// const client = new GraphQLClient("https://graphql.anilist.co/", {
|
||||
// fetch: (input, init) => {
|
||||
// console.log("custom fetch");
|
||||
// const agent = new HttpsProxyAgent(
|
||||
// "http://ruru:pdh!CQB@kpc3vyb3cwc@45.56.108.251:3128",
|
||||
// );
|
||||
// return nodeFetch(input, { ...init, agent });
|
||||
// },
|
||||
// });
|
||||
|
||||
// console.log(
|
||||
// await client
|
||||
// .request(GetTitleQuery, { id: 186794 })
|
||||
// .then((data) => data?.Media ?? undefined),
|
||||
// );
|
||||
Reference in New Issue
Block a user