Anisurge / extensions
GitHub

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 name
  • name, author, description
  • version (e.g. 0.1.0) and versionCode (integer, start at 1)
  • pipeline.resolve ending with map.videos

Full reference: Schema.

3. Resolve context

Injected by the app before the pipeline runs:

VariableMeaning
anilistIdAniList media id
malIdMAL id (0 if unknown)
episodeEpisode number
langsub or dub
titleBest-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

  1. Host the .asx over HTTPS (raw GitHub is fine).
  2. Open a deep link:
anisurgex://extensions/install?type=source&engine=ANISURGE&url=HTTPS_URL&name=MyCoolSource&version=0.1.0
  1. 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 versionCode on every behavior change
  • Keep index.json in sync
  • No secrets or private tokens in packs
  • Set nsfw: true when appropriate

Runtime flow (app)

  1. User adds this repo or installs via deep link
  2. App downloads .asx, validates schema, stores under local anisurge/{id}/
  3. On play: run pipeline.resolve with AniList/MAL + episode + lang
  4. map.videos produces the stream list
  5. Catalog versionCode higher than installed → Update badge