javdb

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package javdb is the public Go SDK for the JavDB app JSON API.

Index

Constants

View Source
const (
	HostMirror = config.HostMirror
	HostMain   = config.HostMain
)

Host constants.

Variables

This section is empty.

Functions

func ActorPeriod

func ActorPeriod(period string) string

ActorPeriod re-export.

func FilterMagnets

func FilterMagnets(magnets []map[string]any, cnsub, hd bool, minSize int) []map[string]any

Re-export magnet helpers for SDK callers.

func LoadOrCreateDeviceUUID added in v0.2.0

func LoadOrCreateDeviceUUID(path string) (string, error)

LoadOrCreateDeviceUUID loads the stable device identifier at path or creates one when the file is absent. CLI callers use it before constructing a client; SDK callers may use it when they need the same identifier across processes.

func MagnetURI

func MagnetURI(m map[string]any) string

func PickBestMagnet

func PickBestMagnet(magnets []map[string]any) map[string]any

Types

type APIError

type APIError = appapi.Error

Error aliases for callers.

type AuthRequired

type AuthRequired = appapi.AuthRequired

Error aliases for callers.

type BrowseOptions

type BrowseOptions = appapi.BrowseOptions

BrowseOptions re-export.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a concrete app-API client.

func New

func New(opts ...Option) (*Client, error)

New builds a Client.

func (*Client) API

func (c *Client) API() *appapi.Client

API 为兼容旧调用方返回底层 adapter。该返回值不是稳定的外部 SDK 契约;新代码应优先使用 typed 方法。 Deprecated: use the documented Client methods instead.

func (*Client) AllEntityMovies

func (c *Client) AllEntityMovies(ctx context.Context, kind, entityID string, opt EntityMoviesOptions, maxPages int) ([]map[string]any, error)

AllEntityMovies aggregates filmography pages.

func (*Client) Browse

func (c *Client) Browse(ctx context.Context, opt BrowseOptions) (SearchResult, error)

Browse lists movies by category filters.

func (*Client) Collected

func (c *Client) Collected(ctx context.Context, kind string) ([]map[string]any, error)

Collected returns a user collection kind.

func (*Client) EntityDetail

func (c *Client) EntityDetail(ctx context.Context, kind, id string) (map[string]any, error)

EntityDetail fetches entity meta.

func (*Client) EntityMovies

func (c *Client) EntityMovies(ctx context.Context, kind, entityID string, opt EntityMoviesOptions) (SearchResult, error)

EntityMovies lists filmography for an entity kind.

func (*Client) ListInfo

func (c *Client) ListInfo(ctx context.Context, listID string) (map[string]any, error)

ListInfo returns list meta payload.

func (*Client) LoadOrRefreshTaxonomy

func (c *Client) LoadOrRefreshTaxonomy(ctx context.Context, zone string, force bool) (*tags.Doc, string, error)

LoadOrRefreshTaxonomy loads disk taxonomy or refreshes.

func (*Client) Login

func (c *Client) Login(ctx context.Context, username, password string) (string, error)

Login authenticates and stores the token on the client. ctx is reserved for future cancellation; the underlying client is not yet context-aware.

func (*Client) Mark

func (c *Client) Mark(ctx context.Context, movieID, status string, score int, content string) (map[string]any, error)

Mark marks a movie watched or want_watch.

func (*Client) MovieDetail

func (c *Client) MovieDetail(ctx context.Context, movieID string) (map[string]any, error)

MovieDetail returns GET /api/v4/movies/{id} nested movie map.

func (*Client) MovieMagnets

func (c *Client) MovieMagnets(ctx context.Context, movieID string) ([]map[string]any, error)

MovieMagnets returns GET /api/v1/movies/{id}/magnets (auth required).

func (*Client) MyLists

func (c *Client) MyLists(ctx context.Context, page, limit int, sortBy string) (SearchResult, error)

MyLists returns the current user's playlists (auth).

func (*Client) RankingsActors

func (c *Client) RankingsActors(ctx context.Context, period string) (SearchResult, error)

RankingsActors fetches actor rankings (period already daily/weekly/monthly or use ActorPeriod).

func (*Client) RankingsMovies

func (c *Client) RankingsMovies(ctx context.Context, type_, period string) (SearchResult, error)

RankingsMovies fetches movie rankings.

func (*Client) RankingsPlayback

func (c *Client) RankingsPlayback(ctx context.Context, filterBy, period string) (SearchResult, error)

RankingsPlayback fetches playback rankings.

func (*Client) RecentViewed

func (c *Client) RecentViewed(ctx context.Context) ([]map[string]any, error)

RecentViewed returns recently viewed movies.

func (*Client) RefreshTagTaxonomy

func (c *Client) RefreshTagTaxonomy(ctx context.Context, zone string) (*tags.Doc, error)

RefreshTagTaxonomy downloads EN+ZH taxonomies and saves tags-{zone}.json.

func (*Client) RelatedLists

func (c *Client) RelatedLists(ctx context.Context, movieID string, page, limit int) (SearchResult, error)

RelatedLists returns public lists related to a movie.

func (*Client) ResolveEntity

func (c *Client) ResolveEntity(ctx context.Context, kind, ref, zone string) (string, error)

ResolveEntity resolves name/id to entity id.

func (*Client) ResolveMovieID

func (c *Client) ResolveMovieID(ctx context.Context, number string) (string, error)

ResolveMovieID maps a printed number to internal id (search zone=all).

func (*Client) ResolveTags

func (c *Client) ResolveTags(ctx context.Context, refs []string, zone string) ([]string, error)

ResolveTags maps free-form tag refs to ids.

func (*Client) ResolveUserID

func (c *Client) ResolveUserID(ctx context.Context) (userID int64, username string, err error)

ResolveUserID returns the numeric user id (and optional display name) for the current token.

func (*Client) Search

func (c *Client) Search(ctx context.Context, keyword string, opt SearchOptions) (SearchResult, error)

Search runs GET /api/v2/search.

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken updates the bearer token.

func (*Client) Token

func (c *Client) Token() string

Token returns the current bearer token.

func (*Client) Top250

func (c *Client) Top250(ctx context.Context, zone, year string, startRank, page, limit int, ignoreWatched bool) (SearchResult, error)

Top250 fetches TOP250 (auth).

func (*Client) Unmark

func (c *Client) Unmark(ctx context.Context, movieID string) (bool, error)

Unmark removes the user's review mark.

func (*Client) WantMovies

func (c *Client) WantMovies(ctx context.Context) ([]map[string]any, error)

WantMovies returns all want_watch (想看) movies.

func (*Client) WatchedMovies

func (c *Client) WatchedMovies(ctx context.Context) ([]map[string]any, error)

WatchedMovies returns all watched (看過) movies.

type EntityMoviesOptions

type EntityMoviesOptions = appapi.EntityMoviesOptions

EntityMoviesOptions re-export.

type Option

type Option func(*options)

Option configures New.

func WithDeviceUUID

func WithDeviceUUID(id string) Option

WithDeviceUUID sets the app device_uuid public param.

func WithHost

func WithHost(host string) Option

WithHost sets logical host (mirror|main) or absolute base URL.

func WithLang

func WithLang(lang string) Option

WithLang sets Accept-Language / app lang.

func WithProxy

func WithProxy(proxy string) Option

WithProxy sets an HTTP(S) proxy URL.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets request timeout.

func WithToken

func WithToken(token string) Option

WithToken sets the bearer token.

type SearchOptions

type SearchOptions = appapi.SearchOptions

SearchOptions is re-exported for SDK callers.

type SearchResult

type SearchResult = appapi.SearchResult

SearchResult is re-exported.

Jump to

Keyboard shortcuts

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