Data Formats (V2 / V1 legacy)
This page defines the input parameters and return structures of each extension entry point, and corresponds one-to-one with the entry functions in JavaScript Extensions (V2) / Go Extensions.
- V2 (current standard):
watch()returns a list of mirrors, thenmirror(url)resolves it into the per-type shapes below. New extensions must use V2. - V1 (legacy-compatible):
watch()returns the final playback shape directly, with nomirror()step — see Data Formats (V1, legacy) at the bottom. Reference only for existing extensions; JavaScript Extensions V1 (legacy) covers its syntax.
Method Parameters (V2)
Section titled “Method Parameters (V2)”// Recently Updatedlatest(page: number)
// Searchsearch(kw: string, page: number, filter?: string)
// Get Detailsdetail(url: string)
// Watch: returns a list of mirrors (V2)watch(url: string)
// Resolve the chosen mirror into the final playback shape (V2)mirror(url: string)
// Check for Updates for Episodes/Chapters (returns string)checkUpdate(url: string)
// Called when unloadingunload() { }
// Called when loadingload(){}func Latest(pkg string, page int) ([]sdk.ExtensionListItem, error)func Search(pkg string, kw string, page int, filter string) ([]sdk.ExtensionListItem, error)func Detail(pkg, url string) (*sdk.ExtensionDetail, error)func Watch(pkg, url string) (*sdk.ExtensionWatch, error)func Mirror(pkg, url string) (*sdk.ExtensionBangumiWatchMirror, error)func Load()Data Returned by Methods (V2)
Section titled “Data Returned by Methods (V2)”ListItem — returned by search / latest
Section titled “ListItem — returned by search / latest”export interface ListItem { title: string; url: string; cover: string; update?: string; type?: string; image?: string; headers?: { [key: string]: string };}type ExtensionListItem struct { Title string `json:"title"` URL string `json:"url"` Cover string `json:"cover"` Update string `json:"update"` Image string `json:"image,omitempty"` Type string `json:"type,omitempty"` Headers map[string]string `json:"headers,omitempty"`}{ "title": "One Piece", "url": "https://example.com/one-piece", "cover": "https://example.com/covers/one-piece.jpg", "update": "EP 1122", "type": "bangumi"}Detail — returned by detail
Section titled “Detail — returned by detail”export interface Detail { title: string; cover: string; desc?: string; description?: string; headers?: { [key: string]: string }; chapters?: Chapter[];}
export interface Chapter { title: string; urls: { name: string; url: string; }[];}type ExtensionDetail struct { Title string `json:"title"` Cover string `json:"cover"` Desc string `json:"desc,omitempty"` Description string `json:"description,omitempty"` Chapters []ExtensionEpisodeGroup `json:"chapters,omitempty"` Headers map[string]string `json:"headers,omitempty"`}
type ExtensionEpisodeGroup struct { Title string `json:"title"` URLs []string `json:"urls,omitempty"`}{ "title": "One Piece", "cover": "https://example.com/covers/one-piece.jpg", "desc": "Gol D. Roger was known as the Pirate King...", "chapters": [ { "title": "East Blue", "urls": ["https://example.com/one-piece/ep/1", "..."] }, { "title": "Alabasta", "urls": ["https://example.com/one-piece/ep/62", "..."] } ]}Watch — returned by watch (V2 mirror list)
Section titled “Watch — returned by watch (V2 mirror list)”export interface WatchList { title?: string; url?: string; type?: string; groups?: { title: string; mirrors: { name: string; url: string; headers?: { [key: string]: string }; }[]; }[];}type ExtensionWatch struct { Title string `json:"title"` URL string `json:"url"` Type string `json:"type"` Groups []ExtensionMirrorGroup `json:"groups,omitempty"`}
type ExtensionMirrorGroup struct { Title string `json:"title"` Mirrors []ExtensionMirror `json:"mirrors,omitempty"`}
type ExtensionMirror struct { Name string `json:"name"` URL string `json:"url"` Headers map[string]string `json:"headers,omitempty"`}{ "title": "One Piece Episode 1", "url": "https://example.com/one-piece/ep/1", "type": "bangumi", "groups": [ { "title": "Sub", "mirrors": [ { "name": "CDN 1", "url": "https://cdn1.example.com/video.m3u8" }, { "name": "CDN 2", "url": "https://cdn2.example.com/video.m3u8" } ] } ]}BangumiWatch — returned by mirror (bangumi)
Section titled “BangumiWatch — returned by mirror (bangumi)”export interface BangumiWatch { type: "hls" | "mp4" | "torrent" | "magnet"; url: string; headers?: { [key: string]: string }; audioTrack?: string; subtitles?: { language?: string; title: string; url: string }[]; tlsConfig?: { profile: string; userAgent?: string; disableRedirect?: boolean; insecureSkipVerify?: boolean; };}type ExtensionBangumiWatchMirror struct { Type BangumiWatchType `json:"type"` URL string `json:"url"` Headers map[string]string `json:"headers,omitempty"` Subtitles []ExtensionBangumiWatchMirrorSubtitle `json:"subtitles,omitempty"` AudioTrack string `json:"audioTrack,omitempty"` TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`}
type ExtensionBangumiWatchMirrorSubtitle struct { Language *string `json:"language,omitempty"` Title string `json:"title"` URL string `json:"url"`}
type TLSConfig struct { Profile string `json:"profile"` UserAgent string `json:"userAgent,omitempty"` DisableRedirect bool `json:"disableRedirect,omitempty"` InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`}{ "type": "hls", "url": "https://cdn.example.com/video.m3u8", "headers": { "Referer": "https://example.com/" }, "subtitles": [ { "language": "en", "title": "English", "url": "https://cdn.example.com/subs/en.vtt" }, { "language": "zh", "title": "中文", "url": "https://cdn.example.com/subs/zh.vtt" } ], "audioTrack": "ja", "tlsConfig": { "profile": "chrome_133", "insecureSkipVerify": true }}{ "type": "torrent", "url": "https://example.com/files/ep1.torrent" }{ "type": "magnet", "url": "magnet:?xt=urn:btih:abc123def456&dn=One+Piece+EP1" }For torrent/magnet content types, the URL carries the raw .torrent link or magnet: URI. Torrent resolution is handled by the frontend or a separate backend endpoint.
MangaWatch — returned by mirror (manga)
Section titled “MangaWatch — returned by mirror (manga)”export interface MangaWatch { urls: string[]; headers?: { [key: string]: string };}type ExtensionMangaWatchMirror struct { URLs []string `json:"urls"` Headers map[string]string `json:"headers,omitempty"`}{ "urls": [ "https://example.com/manga/ch1/p1.jpg", "https://example.com/manga/ch1/p2.jpg", "https://example.com/manga/ch1/p3.jpg" ], "headers": { "Referer": "https://example.com/" }}FikushonWatch — returned by mirror (fikushon)
Section titled “FikushonWatch — returned by mirror (fikushon)”export interface FikushonWatch { content: string[]; title: string; subtitle?: string;}type ExtensionFikushonWatchMirror struct { Content []string `json:"content"` Title string `json:"title"` Subtitle string `json:"subtitle,omitempty"`}{ "content": [ "It was a dark and stormy night...", "The hero stepped forward.", "And so the journey began." ], "title": "My Novel", "subtitle": "Chapter 1"}AllMirror — returned by watch (@type all)
Section titled “AllMirror — returned by watch (@type all)”// Only used for @type all extensions.// One of manga / fikushon / bangumi will be populated.type ExtensionAllMirror struct { Manga *ExtensionMangaWatchMirror `json:"manga,omitempty"` Fikushon *ExtensionFikushonWatchMirror `json:"fikushon,omitempty"` Bangumi *ExtensionBangumiWatchMirror `json:"bangumi,omitempty"`}Only one member is populated per item.
Data Formats (V1, legacy)
Section titled “Data Formats (V1, legacy)”Legacy V1 extensions are written as class extends Extension; watch() returns the final playback shape directly, with no mirror() step. The return structures are the same as the V2 BangumiWatch / MangaWatch / FikushonWatch above — only the watch contract differs:
// V1 entry points (compatibility reference)class Extension { latest(page) { /* ... */ } search(kw, page, filter) { /* ... */ } // V1 receives filter too; may be ignored detail(url) { /* ... */ } watch(url) { // returns the final playback shape directly, e.g.: return { type: "hls", url: "https://.../a.m3u8", headers: {} }; // or manga: { urls: [...] } / fikushon: { content: [...], title, subtitle } } load() { /* ... */ }}