GogoanimeProvider
GogoanimeProvider scrapes anineko.to (the current Gogoanime mirror). It parses anime cards from search results, extracts episode lists from watch pages, and pulls stream URLs from data-video attributes on server buttons.
Constructor
Section titled “Constructor”import { HttpClient, GogoanimeProvider } from 'anime-sdk';
const provider = new GogoanimeProvider(new HttpClient({ timeoutMs: 10_000 }));
// Override the base URL if the site has moved:const provider = new GogoanimeProvider(client, { baseUrl: 'https://anineko.to',});interface GogoanimeOptions { baseUrl?: string; // defaults to 'https://anineko.to'}import { HttpClient, GogoanimeProvider } from 'anime-sdk';
const provider = new GogoanimeProvider(new HttpClient({ timeoutMs: 10_000 }));
// Searchconst shows = await provider.search('One Piece');// shows[0] => { id: '/watch/one-piece', title: 'One Piece',// thumbnailUrl: 'https://...', catalogType: 'ANIME',// providerId: 'gogoanime' }
// Episodes: language-agnostic; gogoanime is sub only.const eps = await provider.fetchContentUnits(shows[0].id);// eps[0] => { id: '/watch/one-piece/ep-1', title: 'Episode 1 - I'm Luffy!',// number: 1, availableLanguages: ['sub'] }
// Streamconst result = await provider.resolveStream(eps[0].id);if (result.type === 'video') { for (const s of result.streams) { console.log(s.sourceUrl, s.quality); // → https://... 'auto' | '720p' | '1080p' | '360p' }}Supported languages
Section titled “Supported languages”| Language | Support |
|---|---|
'sub' | Full |
'dub' | Falls back to 'sub' |
'raw' | Falls back to 'sub' |
The language parameter to resolveStream is accepted but ignored. All content units report availableLanguages: ['sub'].
ID formats
Section titled “ID formats”- Media ID (from
search): a URL path, e.g./watch/one-piece - Content unit ID (from
fetchContentUnits): a full episode path, e.g./watch/one-piece/ep-1
fetchContentUnits normalises its mediaId argument: it strips episode suffixes and prepends /watch/ if needed, so passing a content unit ID back is handled gracefully.
How it works
Section titled “How it works”- Search: GET
{baseUrl}/browser?keyword={query}. Parsesarticle.nv-anime-cardelements: the<a>insideh3.nv-anime-titleprovides the ID and title;<img>provides the thumbnail. - Episodes: GET the watch page. Parses
article.nv-info-episode-itemelements. Each<a.nv-info-episode-main>has anhref(the content unit ID); the episode number is extracted from theep-Nsegment of the path. - Stream resolution: GET the episode page. Parses
button.nv-server-btnelements to collect embed URLs fromdata-videoattributes. Each URL is passed sequentially toGenericHlsExtractor, which fetches the embed page and scans it for a.m3u8URL. Returns on the first successful extraction.
A User-Agent header (Chrome/120) is set automatically on the HttpClient if one isn’t already configured: anineko.to rejects requests without one.
resolveStreamruns embed URLs throughGenericHlsExtractorsequentially and returns on the first successful extraction, so resolution is fast (~0.5s) even when multiple server buttons are present. Falls back to raw embed URLs if nothing resolves.- If anineko.to changes domain, pass the new URL via
options.baseUrl.