node build fixed

This commit is contained in:
ra_ma
2025-09-20 14:08:38 +01:00
parent c6ebbe069d
commit 3d298fa434
1516 changed files with 535727 additions and 2 deletions

View File

@@ -0,0 +1,97 @@
package hibikemanga
type (
Provider interface {
// Search returns the search results for the given query.
Search(opts SearchOptions) ([]*SearchResult, error)
// FindChapters returns the chapter details for the given manga ID.
FindChapters(id string) ([]*ChapterDetails, error)
// FindChapterPages returns the chapter pages for the given chapter ID.
FindChapterPages(id string) ([]*ChapterPage, error)
// GetSettings returns the provider settings.
GetSettings() Settings
}
Settings struct {
SupportsMultiScanlator bool `json:"supportsMultiScanlator"`
SupportsMultiLanguage bool `json:"supportsMultiLanguage"`
}
SearchOptions struct {
Query string `json:"query"`
// Year is the year the manga was released.
// It will be 0 if the year is not available.
Year int `json:"year"`
}
SearchResult struct {
// "ID" of the extension.
Provider string `json:"provider"`
// ID of the manga, used to fetch the chapter details.
// It can be a combination of keys separated by a delimiter. (Delimiters should not be slashes).
ID string `json:"id"`
// The title of the manga.
Title string `json:"title"`
// Synonyms are alternative titles for the manga.
Synonyms []string `json:"synonyms,omitempty"`
// Year the manga was released.
Year int `json:"year,omitempty"`
// URL of the manga cover image.
Image string `json:"image,omitempty"`
// Indicates how well the chapter title matches the search query.
// It is a number from 0 to 1.
// Leave it empty if the comparison should be done by Seanime.
SearchRating float64 `json:"searchRating,omitempty"`
}
ChapterDetails struct {
// "ID" of the extension.
// This should be the same as the extension ID and follow the same format.
Provider string `json:"provider"`
// ID of the chapter, used to fetch the chapter pages.
// It can be a combination of keys separated by a delimiter. (Delimiters should not be slashes).
// If the same ID has multiple languages, the language key should be included. (e.g., "one-piece-001$chapter-1$en").
// If the same ID has multiple scanlators, the group key should be included. (e.g., "one-piece-001$chapter-1$group-1").
ID string `json:"id"`
// The chapter page URL.
URL string `json:"url"`
// The chapter title.
// It should be in this format: "Chapter X.Y - {title}" where X is the chapter number and Y is the subchapter number.
Title string `json:"title"`
// e.g., "1", "1.5", "2", "3"
Chapter string `json:"chapter"`
// From 0 to n
Index uint `json:"index"`
// The scanlator that translated the chapter.
// Leave it empty if your extension does not support multiple scanlators.
Scanlator string `json:"scanlator,omitempty"`
// The language of the chapter.
// Leave it empty if your extension does not support multiple languages.
Language string `json:"language,omitempty"`
// The rating of the chapter. It is a number from 0 to 100.
// Leave it empty if the rating is not available.
Rating int `json:"rating,omitempty"`
// UpdatedAt is the date when the chapter was last updated.
// It should be in the format "YYYY-MM-DD".
// Leave it empty if the date is not available.
UpdatedAt string `json:"updatedAt,omitempty"`
// LocalIsPDF is true if the chapter is a single, readable PDF file.
LocalIsPDF bool `json:"localIsPDF,omitempty"`
}
ChapterPage struct {
// ID of the provider.
// This should be the same as the extension ID and follow the same format.
Provider string `json:"provider"`
// URL of the chapter page.
URL string `json:"url"`
// Index of the page in the chapter.
// From 0 to n.
Index int `json:"index"`
// Request headers for the page if proxying is required.
Headers map[string]string `json:"headers"`
Buf []byte `json:"-"`
}
)

View File

@@ -0,0 +1,146 @@
package hibikeonlinestream
type (
Provider interface {
Search(opts SearchOptions) ([]*SearchResult, error)
// FindEpisodes returns the episodes for the given anime ID.
FindEpisodes(id string) ([]*EpisodeDetails, error)
// FindEpisodeServer returns the episode server for the given episode.
// The "server" argument can be "default"
FindEpisodeServer(episode *EpisodeDetails, server string) (*EpisodeServer, error)
// GetSettings returns the provider settings.
GetSettings() Settings
}
SearchOptions struct {
// The media object provided by Seanime.
Media Media `json:"media"`
// The search query.
Query string `json:"query"`
// Whether to search for subbed or dubbed anime.
Dub bool `json:"dub"`
// The year the anime was released.
// Will be 0 if the year is not available.
Year int `json:"year"`
}
Media struct {
// AniList ID of the media.
ID int `json:"id"`
// MyAnimeList ID of the media.
IDMal *int `json:"idMal,omitempty"`
// e.g. "FINISHED", "RELEASING", "NOT_YET_RELEASED", "CANCELLED", "HIATUS"
// This will be set to "NOT_YET_RELEASED" if the status is unknown.
Status string `json:"status,omitempty"`
// e.g. "TV", "TV_SHORT", "MOVIE", "SPECIAL", "OVA", "ONA", "MUSIC"
// This will be set to "TV" if the format is unknown.
Format string `json:"format,omitempty"`
// e.g. "Attack on Titan"
// This will be undefined if the english title is unknown.
EnglishTitle *string `json:"englishTitle,omitempty"`
// e.g. "Shingeki no Kyojin"
RomajiTitle string `json:"romajiTitle,omitempty"`
// TotalEpisodes is total number of episodes of the media.
// This will be -1 if the total number of episodes is unknown / not applicable.
EpisodeCount int `json:"episodeCount,omitempty"`
// All alternative titles of the media.
Synonyms []string `json:"synonyms"`
// Whether the media is NSFW.
IsAdult bool `json:"isAdult"`
// Start date of the media.
// This will be undefined if it has no start date.
StartDate *FuzzyDate `json:"startDate,omitempty"`
}
FuzzyDate struct {
Year int `json:"year"`
Month *int `json:"month"`
Day *int `json:"day"`
}
Settings struct {
EpisodeServers []string `json:"episodeServers"`
SupportsDub bool `json:"supportsDub"`
}
SearchResult struct {
// ID is the anime slug.
// It is used to fetch the episode details.
ID string `json:"id"`
// Title is the anime title.
Title string `json:"title"`
// URL is the anime page URL.
URL string `json:"url"`
SubOrDub SubOrDub `json:"subOrDub"`
}
// EpisodeDetails contains the episode information from a provider.
// It is obtained by scraping the list of episodes.
EpisodeDetails struct {
// "ID" of the extension.
Provider string `json:"provider"`
// ID is the episode slug.
// e.g. "the-apothecary-diaries-18578".
ID string `json:"id"`
// Episode number.
// From 0 to n.
Number int `json:"number"`
// Episode page URL.
URL string `json:"url"`
// Episode title.
// Leave it empty if the episode title is not available.
Title string `json:"title,omitempty"`
}
// EpisodeServer contains the server, headers and video sources for an episode.
EpisodeServer struct {
// "ID" of the extension.
Provider string `json:"provider"`
// Episode server name.
// e.g. "vidcloud".
Server string `json:"server"`
// HTTP headers for the video request.
Headers map[string]string `json:"headers"`
// Video sources for the episode.
VideoSources []*VideoSource `json:"videoSources"`
}
SubOrDub string
VideoSourceType string
VideoSource struct {
// URL of the video source.
URL string `json:"url"`
// Type of the video source.
Type VideoSourceType `json:"type"`
// Quality of the video source.
// e.g. "default", "auto", "1080p".
Quality string `json:"quality"`
// Subtitles for the video source.
Subtitles []*VideoSubtitle `json:"subtitles"`
}
VideoSubtitle struct {
ID string `json:"id"`
URL string `json:"url"`
// e.g. "en", "fr"
Language string `json:"language"`
IsDefault bool `json:"isDefault"`
}
VideoExtractor interface {
Extract(uri string) ([]*VideoSource, error)
}
)
const (
Sub SubOrDub = "sub"
Dub SubOrDub = "dub"
SubAndDub SubOrDub = "both"
)
const (
VideoSourceMP4 VideoSourceType = "mp4"
VideoSourceM3U8 VideoSourceType = "m3u8"
)

View File

@@ -0,0 +1,170 @@
package hibiketorrent
// Resolutions represent resolution filters available to the user.
var Resolutions = []string{"1080", "720", "540", "480"}
const (
// AnimeProviderTypeMain providers can be used as default providers.
AnimeProviderTypeMain AnimeProviderType = "main"
// AnimeProviderTypeSpecial providers cannot be set as default provider.
// Providers that return only specific content (e.g. adult content).
// These providers should not return anything from "GetLatest".
AnimeProviderTypeSpecial AnimeProviderType = "special"
)
const (
AnimeProviderSmartSearchFilterBatch AnimeProviderSmartSearchFilter = "batch"
AnimeProviderSmartSearchFilterEpisodeNumber AnimeProviderSmartSearchFilter = "episodeNumber"
AnimeProviderSmartSearchFilterResolution AnimeProviderSmartSearchFilter = "resolution"
AnimeProviderSmartSearchFilterQuery AnimeProviderSmartSearchFilter = "query"
AnimeProviderSmartSearchFilterBestReleases AnimeProviderSmartSearchFilter = "bestReleases"
)
type (
AnimeProviderType string
AnimeProviderSmartSearchFilter string
AnimeProviderSettings struct {
CanSmartSearch bool `json:"canSmartSearch"`
SmartSearchFilters []AnimeProviderSmartSearchFilter `json:"smartSearchFilters"`
SupportsAdult bool `json:"supportsAdult"`
Type AnimeProviderType `json:"type"`
}
AnimeProvider interface {
// Search for torrents.
Search(opts AnimeSearchOptions) ([]*AnimeTorrent, error)
// SmartSearch for torrents.
SmartSearch(opts AnimeSmartSearchOptions) ([]*AnimeTorrent, error)
// GetTorrentInfoHash returns the info hash of the torrent.
// This should just return the info hash without scraping the torrent page if already available.
GetTorrentInfoHash(torrent *AnimeTorrent) (string, error)
// GetTorrentMagnetLink returns the magnet link of the torrent.
// This should just return the magnet link without scraping the torrent page if already available.
GetTorrentMagnetLink(torrent *AnimeTorrent) (string, error)
// GetLatest returns the latest torrents.
GetLatest() ([]*AnimeTorrent, error)
// GetSettings returns the provider settings.
GetSettings() AnimeProviderSettings
}
Media struct {
// AniList ID of the media.
ID int `json:"id"`
// MyAnimeList ID of the media.
IDMal *int `json:"idMal,omitempty"`
// e.g. "FINISHED", "RELEASING", "NOT_YET_RELEASED", "CANCELLED", "HIATUS"
// This will be set to "NOT_YET_RELEASED" if the status is unknown.
Status string `json:"status,omitempty"`
// e.g. "TV", "TV_SHORT", "MOVIE", "SPECIAL", "OVA", "ONA", "MUSIC"
// This will be set to "TV" if the format is unknown.
Format string `json:"format,omitempty"`
// e.g. "Attack on Titan"
// This will be undefined if the english title is unknown.
EnglishTitle *string `json:"englishTitle,omitempty"`
// e.g. "Shingeki no Kyojin"
RomajiTitle string `json:"romajiTitle,omitempty"`
// TotalEpisodes is total number of episodes of the media.
// This will be -1 if the total number of episodes is unknown / not applicable.
EpisodeCount int `json:"episodeCount,omitempty"`
// Absolute offset of the media's season.
// This will be 0 if the media is not seasonal or the offset is unknown.
AbsoluteSeasonOffset int `json:"absoluteSeasonOffset,omitempty"`
// All alternative titles of the media.
Synonyms []string `json:"synonyms"`
// Whether the media is NSFW.
IsAdult bool `json:"isAdult"`
// Start date of the media.
// This will be undefined if it has no start date.
StartDate *FuzzyDate `json:"startDate,omitempty"`
}
FuzzyDate struct {
Year int `json:"year"`
Month *int `json:"month"`
Day *int `json:"day"`
}
// AnimeSearchOptions represents the options to search for torrents without filters.
AnimeSearchOptions struct {
// The media object provided by Seanime.
Media Media `json:"media"`
// The user search query.
Query string `json:"query"`
}
AnimeSmartSearchOptions struct {
// The media object provided by Seanime.
Media Media `json:"media"`
// The user search query.
// This will be empty if your extension does not support custom queries.
Query string `json:"query"`
// Indicates whether the user wants to search for batch torrents.
// This will be false if your extension does not support batch torrents.
Batch bool `json:"batch"`
// The episode number the user wants to search for.
// This will be 0 if your extension does not support episode number filtering.
EpisodeNumber int `json:"episodeNumber"`
// The resolution the user wants to search for.
// This will be empty if your extension does not support resolution filtering.
// e.g. "1080", "720"
Resolution string `json:"resolution"`
// AniDB Anime ID of the media.
AnidbAID int `json:"anidbAID"`
// AniDB Episode ID of the media.
AnidbEID int `json:"anidbEID"`
// Indicates whether the user wants to search for the best releases.
// This will be false if your extension does not support filtering by best releases.
BestReleases bool `json:"bestReleases"`
}
AnimeTorrent struct {
// "ID" of the extension.
Provider string `json:"provider,omitempty"`
// Title of the torrent.
Name string `json:"name"`
// Date of the torrent.
// The date should have RFC3339 format. e.g. "2006-01-02T15:04:05Z07:00"
Date string `json:"date"`
// Size of the torrent in bytes.
Size int64 `json:"size"`
// Formatted size of the torrent. e.g. "1.2 GB"
// Leave this empty if you want Seanime to format the size.
FormattedSize string `json:"formattedSize"`
// Number of seeders.
Seeders int `json:"seeders"`
// Number of leechers.
Leechers int `json:"leechers"`
// Number of downloads.
DownloadCount int `json:"downloadCount"`
// Link to the torrent page.
Link string `json:"link"`
// Download URL of the torrent.
// Leave this empty if you cannot provide a direct download URL.
DownloadUrl string `json:"downloadUrl"`
// Magnet link of the torrent.
// Leave this empty if you cannot provide a magnet link without scraping.
MagnetLink string `json:"magnetLink,omitempty"`
// InfoHash of the torrent.
// Leave empty if it should be scraped later.
InfoHash string `json:"infoHash,omitempty"`
// Resolution of the video.
// e.g. "1080p", "720p"
Resolution string `json:"resolution,omitempty"`
// Set this to true if you can confirm that the torrent is a batch.
// Else, Seanime will parse the torrent name to determine if it's a batch.
IsBatch bool `json:"isBatch,omitempty"`
// Episode number of the torrent.
// Return -1 if unknown / unable to determine and Seanime will parse the torrent name.
EpisodeNumber int `json:"episodeNumber,omitempty"`
// Release group of the torrent.
// Leave this empty if you want Seanime to parse the release group from the name.
ReleaseGroup string `json:"releaseGroup,omitempty"`
// Set this to true if you can confirm that the torrent is the best release.
IsBestRelease bool `json:"isBestRelease"`
// Set this to true if you can confirm that the torrent matches the anime the user is searching for.
// e.g. If the torrent was found using the AniDB anime or episode ID
Confirmed bool `json:"confirmed"`
}
)

View File

@@ -0,0 +1,8 @@
package hibikextension
type (
SelectOption struct {
Value string `json:"value"`
Label string `json:"label"`
}
)