Documentation
¶
Overview ¶
Package api provides enhanced episode URL fetching with AllAnime navigation support
Package api provides enhanced anime search and streaming capabilities ¶
Package api provides episode data fetching from multiple sources with fallback support. This enables robust episode information retrieval even when primary APIs are unavailable.
Index ¶
- Variables
- func CleanTitle(title string) string
- func DownloadAllAnimeSmartRange(anime *models.Anime, startEp, endEp int, quality string) error
- func DownloadEpisodeEnhanced(anime *models.Anime, episodeNum int, quality string) error
- func DownloadEpisodeRangeEnhanced(anime *models.Anime, startEp, endEp int, quality string) error
- func FetchAnimeData(animeID int, episodeNo int, anime *models.Anime) error
- func FetchAnimeDetails(anime *models.Anime) error
- func FetchAnimeFromAniList(animeName string) (*models.AniListResponse, error)
- func GetAllAnimeEpisodeURLDirect(anime *models.Anime, episodeNumber string, quality string) (string, map[string]string, error)
- func GetAndParseAniSkipData(animeMalId int, episodeNum int, episode *models.Episode) error
- func GetAniSkipData(animeMalId int, episode int) (string, error)
- func GetAnimeEpisodes(animeURL string) ([]models.Episode, error)
- func GetAnimeEpisodesEnhanced(anime *models.Anime) ([]models.Episode, error)
- func GetAnimeEpisodesWithSource(anime *models.Anime) ([]models.Episode, error)
- func GetEpisodeData(animeID int, episodeNo int, anime *models.Anime) error
- func GetEpisodeDataWithFallback(animeID int, episodeNo int, anime *models.Anime) error
- func GetEpisodeStreamURL(episode *models.Episode, anime *models.Anime, quality string) (string, error)
- func GetEpisodeStreamURLEnhanced(episode *models.Episode, anime *models.Anime, quality string) (string, error)
- func GetFlixHQEpisodes(media *models.Anime) ([]models.Episode, error)
- func GetFlixHQStreamURL(media *models.Anime, episode *models.Episode, quality string) (string, []models.Subtitle, error)
- func GetMovieData(animeID int, anime *models.Anime) error
- func IsDisallowedIP(hostIP string) bool
- func IsSeries(animeURL string) (bool, int, error)
- func IsSeriesEnhanced(anime *models.Anime) (bool, int, error)
- func ParseAniSkipResponse(responseText string, episode *models.Episode, timePrecision int) error
- func ParseAnimes(doc *goquery.Document) []models.Anime
- func RoundTime(timeValue float64, precision int) float64
- func SafeGet(url string) (*http.Response, error)
- func SafeTransport(timeout time.Duration) *http.Transport
- func SearchAnime(animeName string) (*models.Anime, error)
- func SearchAnimeEnhanced(name string, source string) (*models.Anime, error)
- func SearchAnimeWithSource(name string, source string) (*models.Anime, error)
- func WriteAniSkipSidecar(videoPath string, ep *models.Episode) error
- type AniListProvider
- type EpisodeDataProvider
- type JikanProvider
- type KitsuProvider
Constants ¶
This section is empty.
Variables ¶
var ErrBackToSearch = errors.New("back to search requested")
ErrBackToSearch is returned when user selects the back option to search again
Functions ¶
func CleanTitle ¶ added in v1.0.9
func DownloadAllAnimeSmartRange ¶ added in v1.6.0
DownloadAllAnimeSmartRange downloads a range of episodes exclusively for AllAnime. It prioritizes high-quality mirrors and writes AniSkip sidecar files for intro/outro skipping.
func DownloadEpisodeEnhanced ¶ added in v1.6.0
Enhanced download support
func DownloadEpisodeRangeEnhanced ¶ added in v1.6.0
Enhanced range download support
func FetchAnimeData ¶ added in v1.1.0
Unified function to fetch anime data from Jikan API
func FetchAnimeDetails ¶ added in v1.0.9
FetchAnimeDetails retrieves additional information for the selected anime
func FetchAnimeFromAniList ¶ added in v1.0.9
func FetchAnimeFromAniList(animeName string) (*models.AniListResponse, error)
func GetAllAnimeEpisodeURLDirect ¶ added in v1.6.0
func GetAllAnimeEpisodeURLDirect(anime *models.Anime, episodeNumber string, quality string) (string, map[string]string, error)
GetAllAnimeEpisodeURLDirect gets streaming URL directly without circular dependencies
func GetAndParseAniSkipData ¶ added in v1.0.9
GetAndParseAniSkipData fetches and parses skip times for a given anime ID and episode
func GetAniSkipData ¶ added in v1.0.9
GetAniSkipData fetches skip times data for a given anime ID and episode
func GetAnimeEpisodes ¶
GetAnimeEpisodes fetches and parses the list of episodes for a given anime. It returns a sorted slice of Episode structs, ordered by episode number.
Parameters: - animeURL: the URL of the anime's page.
Returns: - []models.Episode: a slice of Episode structs, sorted by episode number. - error: an error if the process fails at any step.
func GetAnimeEpisodesEnhanced ¶ added in v1.6.0
Enhanced episode fetching that works with different sources
func GetAnimeEpisodesWithSource ¶ added in v1.6.0
func GetEpisodeData ¶ added in v1.0.9
GetEpisodeData fetches episode data using multiple providers with fallback support. It tries Jikan (MyAnimeList) first, then falls back to AniList and Kitsu if needed. This provides robust episode data retrieval even when primary APIs are unavailable.
func GetEpisodeDataWithFallback ¶ added in v1.6.0
GetEpisodeDataWithFallback fetches episode data trying multiple providers
func GetEpisodeStreamURL ¶ added in v1.6.0
func GetEpisodeStreamURL(episode *models.Episode, anime *models.Anime, quality string) (string, error)
Enhanced episode URL fetching with improved source detection
func GetEpisodeStreamURLEnhanced ¶ added in v1.6.0
func GetEpisodeStreamURLEnhanced(episode *models.Episode, anime *models.Anime, quality string) (string, error)
GetEpisodeStreamURLEnhanced gets streaming URL with AllAnime navigation support
func GetFlixHQEpisodes ¶ added in v1.6.0
GetFlixHQEpisodes handles episodes/content for FlixHQ movies and TV shows
func GetFlixHQStreamURL ¶ added in v1.6.0
func GetFlixHQStreamURL(media *models.Anime, episode *models.Episode, quality string) (string, []models.Subtitle, error)
GetFlixHQStreamURL gets the stream URL for FlixHQ content
func GetMovieData ¶ added in v1.0.9
GetMovieData fetches movie/OVA data for a given anime ID from Jikan API
func IsDisallowedIP ¶
IsDisallowedIP checks if the given IP address falls under a disallowed category. It returns true if the IP address is multicast, unspecified, loopback, or private.
Parameters: - hostIP: a string representing the IP address to check.
Returns: - bool: true if the IP address is disallowed, false otherwise.
func IsSeries ¶
IsSeries checks if the given anime URL corresponds to a series (multiple episodes). It returns a boolean indicating if the anime has more than one episode, the total number of episodes, and an error if any issues occur.
Parameters: - animeURL: the URL of the anime's page.
Returns: - bool: true if the anime has more than one episode (i.e., is a series), false otherwise. - int: the total number of episodes found. - error: an error if the process of retrieving episodes fails.
func IsSeriesEnhanced ¶ added in v1.6.0
IsSeriesEnhanced checks if the given anime corresponds to a series using enhanced API
func ParseAniSkipResponse ¶ added in v1.0.9
ParseAniSkipResponse parses the response text from the AniSkip API and updates the Episode struct
func SafeGet ¶
SafeGet performs an HTTP GET request to the specified URL using a custom HTTP client with a timeout. The function returns the response or an error if the request fails.
Parameters: - url: the URL to send the GET request to.
Returns: - *http.Response: a pointer to the HTTP response object containing the server's response. - error: an error if the request fails or if there is a problem during the request.
func SafeTransport ¶
SafeTransport returns an http.Transport with custom dial functions for both regular and TLS connections. The transport is configured with a specified timeout and ensures that all TLS connections use a minimum version of TLS 1.2.
Parameters: - timeout: the duration for both the connection timeout and the TLS handshake timeout.
Returns: - *http.Transport: a pointer to an http.Transport configured with custom dial functions and security settings.
func SearchAnimeEnhanced ¶ added in v1.6.0
Enhanced search that supports multiple sources - always searches both Animefire.io and allanime simultaneously
func SearchAnimeWithSource ¶ added in v1.6.0
Legacy wrapper functions to maintain compatibility
func WriteAniSkipSidecar ¶ added in v1.6.0
WriteAniSkipSidecar is an exported wrapper to write AniSkip sidecar files. It delegates to the internal writeAniSkipSidecar and exists to allow other packages (e.g., player) to generate the sidecar after downloads.
Types ¶
type AniListProvider ¶ added in v1.6.0
type AniListProvider struct{}
AniListProvider fetches episode data from AniList GraphQL API
func (*AniListProvider) FetchEpisodeData ¶ added in v1.6.0
func (*AniListProvider) Name ¶ added in v1.6.0
func (p *AniListProvider) Name() string
type EpisodeDataProvider ¶ added in v1.6.0
type EpisodeDataProvider interface {
Name() string
FetchEpisodeData(animeID int, episodeNo int, anime *models.Anime) error
}
EpisodeDataProvider defines an interface for fetching episode data from various sources
type JikanProvider ¶ added in v1.6.0
type JikanProvider struct{}
JikanProvider fetches episode data from Jikan (MyAnimeList) API
func (*JikanProvider) FetchEpisodeData ¶ added in v1.6.0
func (*JikanProvider) Name ¶ added in v1.6.0
func (p *JikanProvider) Name() string
type KitsuProvider ¶ added in v1.6.0
type KitsuProvider struct{}
KitsuProvider fetches episode data from Kitsu API
func (*KitsuProvider) FetchEpisodeData ¶ added in v1.6.0
func (*KitsuProvider) Name ¶ added in v1.6.0
func (p *KitsuProvider) Name() string