mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
feat: add a111477 provider
This commit is contained in:
24
providers/a111477/catalog.ts
Normal file
24
providers/a111477/catalog.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export const catalog = [
|
||||
{
|
||||
title: "Movies",
|
||||
filter: "/movies/",
|
||||
},
|
||||
{
|
||||
title: "TV Shows",
|
||||
filter: "/tvs/",
|
||||
},
|
||||
{
|
||||
title: "K-Drama",
|
||||
filter: "/kdrama/",
|
||||
},
|
||||
{
|
||||
title: "Asian Drama",
|
||||
filter: "/asiandrama/",
|
||||
},
|
||||
{
|
||||
title: "Misc",
|
||||
filter: "/misc/",
|
||||
},
|
||||
];
|
||||
|
||||
export const genres = [];
|
||||
69
providers/a111477/episodes.ts
Normal file
69
providers/a111477/episodes.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
export const getEpisodes = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
const res = await axios.get(url);
|
||||
const html = res.data;
|
||||
const $ = cheerio.load(html);
|
||||
const episodeLinks: EpisodeLink[] = [];
|
||||
|
||||
// Parse episode files from directory
|
||||
$("table tbody tr").each((i, element) => {
|
||||
const $row = $(element);
|
||||
const linkElement = $row.find("td:first-child a");
|
||||
const fileName = linkElement.text().trim();
|
||||
const fileLink = linkElement.attr("href");
|
||||
|
||||
if (
|
||||
fileName &&
|
||||
fileLink &&
|
||||
fileName !== "../" &&
|
||||
fileName !== "Parent Directory"
|
||||
) {
|
||||
// Check if it's a video file
|
||||
if (
|
||||
fileName.includes(".mp4") ||
|
||||
fileName.includes(".mkv") ||
|
||||
fileName.includes(".avi") ||
|
||||
fileName.includes(".mov")
|
||||
) {
|
||||
const fullLink = url + fileLink;
|
||||
|
||||
// Try to extract episode information from filename
|
||||
let episodeTitle = fileName;
|
||||
const episodeMatch = fileName.match(/[Ss](\d+)[Ee](\d+)/);
|
||||
const simpleEpisodeMatch = fileName.match(/[Ee](\d+)/);
|
||||
|
||||
if (episodeMatch) {
|
||||
episodeTitle = `S${episodeMatch[1]}E${episodeMatch[2]} - ${fileName}`;
|
||||
} else if (simpleEpisodeMatch) {
|
||||
episodeTitle = `Episode ${simpleEpisodeMatch[1]} - ${fileName}`;
|
||||
} else {
|
||||
// Try to extract episode number from various patterns
|
||||
const numberMatch = fileName.match(/(\d+)/);
|
||||
if (numberMatch) {
|
||||
episodeTitle = `Episode ${numberMatch[1]} - ${fileName}`;
|
||||
}
|
||||
}
|
||||
|
||||
episodeLinks.push({
|
||||
title: episodeTitle,
|
||||
link: fullLink,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return episodeLinks;
|
||||
} catch (err) {
|
||||
console.error("111477 episodes error:", err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
103
providers/a111477/meta.ts
Normal file
103
providers/a111477/meta.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import { EpisodeLink, Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
// Extract title from the page header or URL
|
||||
const pageTitle =
|
||||
$("h1").text().trim() || url.split("/").filter(Boolean).pop() || "";
|
||||
const title = pageTitle.replace("Index of /", "").replace(/\/$/, "");
|
||||
|
||||
const links: Link[] = [];
|
||||
const directLinks: EpisodeLink[] = [];
|
||||
|
||||
// Parse directory structure
|
||||
$("table tbody tr").each((i, element) => {
|
||||
const $row = $(element);
|
||||
const linkElement = $row.find("td:first-child a");
|
||||
const itemTitle = linkElement.text().trim();
|
||||
const itemLink = linkElement.attr("href");
|
||||
|
||||
if (
|
||||
itemTitle &&
|
||||
itemLink &&
|
||||
itemTitle !== "../" &&
|
||||
itemTitle !== "Parent Directory"
|
||||
) {
|
||||
const fullLink = link + itemLink;
|
||||
|
||||
// If it's a directory (ends with /)
|
||||
if (itemTitle.endsWith("/")) {
|
||||
const cleanTitle = itemTitle.replace(/\/$/, "");
|
||||
links.push({
|
||||
episodesLink: fullLink,
|
||||
title: cleanTitle,
|
||||
});
|
||||
}
|
||||
// If it's a video file
|
||||
else if (
|
||||
itemTitle.includes(".mp4") ||
|
||||
itemTitle.includes(".mkv") ||
|
||||
itemTitle.includes(".avi") ||
|
||||
itemTitle.includes(".mov")
|
||||
) {
|
||||
directLinks.push({
|
||||
title: itemTitle,
|
||||
link: fullLink,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// If there are direct video files, add them as a direct link group
|
||||
if (directLinks.length > 0) {
|
||||
links.push({
|
||||
title: title + " (Direct Files)",
|
||||
directLinks: directLinks,
|
||||
});
|
||||
}
|
||||
|
||||
// Determine if this is a movie or series based on structure
|
||||
const type = links.some(
|
||||
(link) =>
|
||||
link.episodesLink?.includes("Season") ||
|
||||
link.episodesLink?.includes("S0")
|
||||
)
|
||||
? "series"
|
||||
: directLinks.length > 1
|
||||
? "series"
|
||||
: "movie";
|
||||
|
||||
return {
|
||||
title: title,
|
||||
synopsis: `Content from 111477.xyz directory`,
|
||||
image: `https://placehold.jp/23/000000/ffffff/300x450.png?text=${encodeURIComponent(
|
||||
title
|
||||
)}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`,
|
||||
imdbId: "",
|
||||
type: type,
|
||||
linkList: links,
|
||||
};
|
||||
} catch (err) {
|
||||
console.error("111477 meta error:", err);
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
128
providers/a111477/posts.ts
Normal file
128
providers/a111477/posts.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
filter: string;
|
||||
page: number;
|
||||
providerValue: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const baseUrl = "https://a.111477.xyz";
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
const url = `${baseUrl}${filter}`;
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
searchQuery: string;
|
||||
page: number;
|
||||
providerValue: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const baseUrl = "https://a.111477.xyz";
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Search through both movies and TV shows directories
|
||||
const moviesPosts = await posts({
|
||||
baseUrl,
|
||||
url: `${baseUrl}/movies/`,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
});
|
||||
const tvsPosts = await posts({
|
||||
baseUrl,
|
||||
url: `${baseUrl}/tvs/`,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
});
|
||||
|
||||
// Combine all posts
|
||||
const allPosts = [...moviesPosts, ...tvsPosts];
|
||||
|
||||
// Filter posts based on search query
|
||||
const filteredPosts = allPosts.filter((post) =>
|
||||
post.title.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
);
|
||||
|
||||
return filteredPosts;
|
||||
};
|
||||
|
||||
async function posts({
|
||||
baseUrl,
|
||||
url,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
}: {
|
||||
baseUrl: string;
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
axios: ProviderContext["axios"];
|
||||
cheerio: ProviderContext["cheerio"];
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const catalog: Post[] = [];
|
||||
|
||||
// Parse the directory listing
|
||||
$("table tbody tr").each((i, element) => {
|
||||
const $row = $(element);
|
||||
const linkElement = $row.find("td:first-child a");
|
||||
const title = linkElement.text().trim();
|
||||
const link = linkElement.attr("href");
|
||||
|
||||
// Skip parent directory and files, only get folders
|
||||
if (
|
||||
title &&
|
||||
link &&
|
||||
title !== "../" &&
|
||||
title !== "Parent Directory" &&
|
||||
title.endsWith("/")
|
||||
) {
|
||||
const cleanTitle = title.replace(/\/$/, ""); // Remove trailing slash
|
||||
const fullLink = url + link;
|
||||
|
||||
// Generate a placeholder image based on title
|
||||
const imageTitle =
|
||||
cleanTitle.length > 30
|
||||
? cleanTitle.slice(0, 30).replace(/\./g, " ")
|
||||
: cleanTitle.replace(/\./g, " ");
|
||||
const image = `https://placehold.jp/23/000000/ffffff/200x400.png?text=${encodeURIComponent(
|
||||
imageTitle
|
||||
)}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`;
|
||||
|
||||
catalog.push({
|
||||
title: cleanTitle,
|
||||
link: fullLink,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error("111477 directory listing error:", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
38
providers/a111477/stream.ts
Normal file
38
providers/a111477/stream.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
|
||||
export const getStream = async function ({
|
||||
link: url,
|
||||
}: {
|
||||
link: string;
|
||||
type: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
try {
|
||||
const stream: Stream[] = [];
|
||||
|
||||
// Get file extension from URL
|
||||
const fileExtension = url.split(".").pop()?.toLowerCase() || "mp4";
|
||||
|
||||
// Determine stream type based on file extension
|
||||
let streamType = "mp4";
|
||||
if (["mkv", "avi", "mov", "webm"].includes(fileExtension)) {
|
||||
streamType = fileExtension;
|
||||
}
|
||||
|
||||
stream.push({
|
||||
server: "111477.xyz",
|
||||
link: url,
|
||||
type: streamType,
|
||||
headers: {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
||||
Referer: "https://a.111477.xyz/",
|
||||
},
|
||||
});
|
||||
|
||||
return stream;
|
||||
} catch (err) {
|
||||
console.error("111477 stream error:", err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user