javascript

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

数据结构

main

js中main函数的参数:

// 参数
argv = [
    {
        Url: "https://mikanani.me/Home/Episode/0c0a30b9b7ee437e33fdea6522eb223377dd1d48", // Link,详情页连接,用于下一步解析番剧信息
        Name: "", // 种子名
        Date: "", // 发布日期
        Torrent: "", // 种子连接
        Hash: "", // 种子hash,唯一ID
    },
    // ...
]
// 返回值
main = {
    index: [0, 1, 2], // 筛选结果
    error: null,
}

日志

// 日志输出
log.debug(...params)
log.info(...params)
log.error(...params)

os.readFile

// 读取文本文件
// 参数
filename // 基于当前插件所在目录的相对路径
// 返回值
os.readFile // 字符串

variable

// 变量
variable.version // AnimeGo版本号
variable.name // 插件名(即不含扩展名的插件文件名)

animeGo.parseName

// 初步解析资源名
// 参数
name = "" // 种子名
// 返回值
animeGo.parseName = {
    TitleRaw: "", // 种子名
    Name: "", // 番剧名
    Season: 0, // 季度
    Ep: 0, // ep
    Group: "", // 字幕组
    Definition: "", // 分辨率
    Sub: "", // 字幕语言
    Source: "", // 资源平台
}

animeGo.getMikanInfo

// 获取Mikan信息
// 参数
url = "https://mikanani.me/Home/Episode/0c0a30b9b7ee437e33fdea6522eb223377dd1d48" // mikanUrl
// 返回值
animeGo.getMikanInfo = {
    ID: 0,
    SubGroupID: 0,
    PubGroupID: 0,
    GroupName: ""
}

其他函数

sleep
sleep(ms) // ms 毫秒,1000ms=1s
print
print(...params)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindScript

func FindScript(file string) string

FindScript

@Description: js插件的文件名列表,依次执行。路径相对于data_path
@Description: 插件名可以忽略'.js'后缀;插件名也可以使用上层文件夹名,会自动加载文件夹内部的 'main.js' 或 'plugin.js'
@Description: 如设置为 'plugin/test',会依次尝试加载 'plugin/test/main.js', 'plugin/test/plugin.js', 'plugin/test.js'
@param file string
@return string

Types

type JavaScript

type JavaScript struct {
	*goja.Runtime
	// contains filtered or unexported fields
}

func (*JavaScript) Execute

func (js *JavaScript) Execute(file string, params Object) (result any)

func (JavaScript) GetMikanInfo

func (js JavaScript) GetMikanInfo(url string) *mikan.MikanInfo

func (JavaScript) ParseName

func (js JavaScript) ParseName(name string) (episode *poketto.Episode)

func (JavaScript) Print

func (js JavaScript) Print(params ...any)

func (*JavaScript) ReadFile

func (js *JavaScript) ReadFile(filename string) string

func (*JavaScript) SetSchema

func (js *JavaScript) SetSchema(paramsSchema, resultSchema []string)

func (JavaScript) Sleep

func (js JavaScript) Sleep(ms int64)

type Object

type Object map[string]any

Object js对象类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL