Skip to content

Getting Started

Miru Alpha’s extension system supports both JavaScript and Go as runtime languages:

  • JavaScript runtime: powered by goja (a pure-Go ECMAScript engine); extension files use the .js suffix.
  • Go runtime: powered by Scriggo (a Go templating/scripting engine); extension files use the .go suffix.

Both kinds of extensions share the same metadata format and data-return structures; they differ mainly in syntax and the engine that runs them. Below we cover the shared metadata first, then give complete JavaScript and Go examples.

To develop extensions you need a working knowledge of JavaScript or Go, plus regular expressions. If you are new to regular expressions, start with “Regular Expressions and String Methods” and “Regular Expressions in 30 Minutes”.

This documentation assumes you have already set up the development environment as described in the Environment Setup section.

For both JS and Go extensions, the file must start with a metadata block wrapped in // ==MiruExtension==// ==/MiruExtension== comments.

// ==MiruExtension==
// @name My Extension
// @version v0.0.1
// @author YourName
// @license MIT
// @lang zh-cn
// @icon https://example.com/icon.png
// @package my.extension
// @type bangumi
// @webSite https://example.com/
// @apiVersion 2
// ==/MiruExtension==

Once the metadata is in place, pick the guide for your language. Each contains the full entry points, request/cache APIs, and a runnable example:

The return structures (list items, detail, and per-type playback shapes) are defined in Data Formats.