Create an extension
Packs are declarative JSON (.asx). There is no TypeScript or JavaScript runtime in the pack file.
The app executes the pipeline steps.
Prerequisites
Anisurge build ≥ 140 · GitHub account · ability to inspect the target site’s HTML/JSON
1. Clone and copy the boilerplate
git clone https://github.com/Anisurge/extensions.git
cd extensions
cp -r boilerplate/my-extension extensions/my-cool-source
# rename my-extension.asx → my-cool-source.asx
2. Edit the pack
Set at least:
id—[a-z0-9-]+, must match the folder namename,author,descriptionversion(e.g.0.1.0) andversionCode(integer, start at1)pipeline.resolveending withmap.videos
Full reference: Schema.
3. Resolve context
Injected by the app before the pipeline runs:
| Variable | Meaning |
|---|---|
anilistId | AniList media id |
malId | MAL id (0 if unknown) |
episode | Episode number |
lang | sub or dub |
title | Best-effort title |
Use as templates: {{anilistId}}, nested paths after parse: {{sources.sources.file}}.
4. Typical pipeline
http.get → fetch HTML/JSON
extract.regex / json.parse / json.get
try → ordered fallbacks (e.g. AniList then MAL)
map.videos → file URL + headers + optional subtitles
Reference implementation: anokoto.asx
5. Validate
node scripts/validate.mjs
node scripts/generate-index.mjs # optional: rebuild index.json
6. Test in the app
- Host the
.asxover HTTPS (raw GitHub is fine). - Open a deep link:
anisurgex://extensions/install?type=source&engine=ANISURGE&url=HTTPS_URL&name=MyCoolSource&version=0.1.0
- Play a title with a known AniList id and confirm Sub/Dub if claimed.
See Testing.
7. Open a pull request
- Prefer one extension per PR
- Bump
versionCodeon every behavior change - Keep
index.jsonin sync - No secrets or private tokens in packs
- Set
nsfw: truewhen appropriate
Runtime flow (app)
- User adds this repo or installs via deep link
- App downloads
.asx, validates schema, stores under localanisurge/{id}/ - On play: run
pipeline.resolvewith AniList/MAL + episode + lang map.videosproduces the stream list- Catalog
versionCodehigher than installed → Update badge