model

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 4 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.

Documentation

Overview

Package model 定义 JavDB App API 的稳定配置、响应和领域类型。

Index

Constants

View Source
const (
	// AppVersion 是请求使用的 App 版本字符串。
	AppVersion = "1.9.28"
	// AppVersionNumber 是请求使用的数值版 App 版本。
	AppVersionNumber = "10928"
	// UserAgent 是 App API 使用的 User-Agent。
	UserAgent = "Dart/3.4 (dart:io)"

	// HostMirror 是默认的 JavDB API 镜像地址。
	HostMirror = "https://jdforrepam.com"
	// HostMain 是 JavDB 主站地址。
	HostMain = "https://javdb.com"
)

Variables

View Source
var EntityLetters = map[string]string{
	"actor":    "a",
	"series":   "s",
	"maker":    "m",
	"director": "d",
	"code":     "c",
	"list":     "l",
}

EntityLetters 将实体类型映射为 filter_by 字母。

View Source
var MainFlags = map[string]bool{
	"p": true, "m": true, "c": true, "s": true, "i": true, "v": true,
}

MainFlags 是 filter_by 支持的 main 属性字母。

View Source
var Zones = map[string]int{
	"censored":   0,
	"uncensored": 1,
	"western":    2,
	"fc2":        3,
}

Zones 是电影类型到 App API 数字掩码的映射。

Functions

This section is empty.

Types

type AuthRequired

type AuthRequired struct {
	API Error
}

AuthRequired 表示 bearer token 无效或已过期,需要重新登录。

func (*AuthRequired) Error

func (e *AuthRequired) Error() string

Error 实现 error。

func (*AuthRequired) Unwrap

func (e *AuthRequired) Unwrap() error

Unwrap 暴露底层的 API Error,保持 errors.Is/As 兼容。

type BrowseOptions

type BrowseOptions struct {
	Zone   string
	Main   []string
	TagIDs []string
	Year   string
	Month  string
	Sort   string
	Order  string
	Page   int
	Limit  int
}

BrowseOptions 配置 /api/v1/movies/tags 分类浏览。

type EntityMoviesOptions

type EntityMoviesOptions struct {
	Zone  string
	Page  int
	Limit int
	Sort  string
	Order string
	Main  []string
	Tags  []string
}

EntityMoviesOptions 配置实体作品列表。

type Error

type Error struct {
	Action  string
	Message string
}

Error 表示 App API 返回的服务端错误(success:0)。

func (*Error) Error

func (e *Error) Error() string

Error 实现 error。

type LoginResponse

type LoginResponse struct {
	Token       string                     `json:"token"`
	AccessToken string                     `json:"access_token"`
	User        json.RawMessage            `json:"user"`
	Raw         map[string]json.RawMessage `json:"-"`
}

LoginResponse 是 POST /api/v1/sessions 的 data payload。

type Options

type Options struct {
	Host       string
	Token      string
	DeviceUUID string
	Proxy      string
	Timeout    time.Duration
	Lang       string
	// Retries 覆盖普通请求的默认重试次数。nil 表示使用默认(2 次);显式 0 用于测速等
	// 需要单次真实请求的探测场景。该内部设置不进入公开 SDK 的自动选线接口。
	Retries *int
	// Device profile(可选覆盖项)。
	AppChannel    string
	SystemVersion string
	DeviceModel   string
	DeviceName    string
}

Options 配置一个签名的 App API client。

type SearchOptions

type SearchOptions struct {
	Page     int
	Limit    int
	Zone     string
	Sort     string
	FilterBy string
	Type     string
}

SearchOptions 配置 /api/v2/search。

Zone 支持 censored、uncensored、western、fc2,以及省略 movie_type 的 all/空值。

type SearchResult

type SearchResult map[string]json.RawMessage

SearchResult 是 /api/v2/search 的宽松 data payload。 实际存在的 key 由 Type 决定(movies/codes/series/actors/makers/directors/lists)。

func (SearchResult) Movies

func (r SearchResult) Movies() []map[string]any

Movies 解码 movies 数组;字段缺失、null 或非法数组返回 nil。

func (SearchResult) Named

func (r SearchResult) Named(key string) []map[string]any

Named 解码指定的命名维度数组(codes、series、actors 等)。

Jump to

Keyboard shortcuts

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