Xtream API client for interacting with Xtream compatible IPTV services.

This class provides methods to query and retrieve various types of content from an Xtream compatible API, including live channels, movies, TV shows, and EPG data. It also supports custom serialization of API responses.

Type Parameters

  • T extends CustomSerializers = CustomSerializers

    Type of custom serializers being used

Constructors

  • Creates a new instance of the Xtream service.

    Type Parameters

    • T extends Partial<Serializers> = Partial<Serializers>

    Parameters

    • options: Options & { serializer?: { type: string; serializers: T } }

      Configuration options for the Xtream client

      • url

        The base URL of the Xtream API

      • username

        The username to authenticate with

      • password

        The password to authenticate with

      • preferredFormat

        Optional preferred streaming format

      • serializer

        Optional custom serializers for transforming API responses

      • Optionalserializer?: { type: string; serializers: T }

        Optional custom serializers for transforming API responses

    Returns Xtream<T>

    Error if required parameters are missing

Properties

baseUrl: string
serializerType: string = 'none'

Indicates the type of serializer being used (e.g., 'none', 'standardized', 'jsonapi') Used for diagnostic and informational purposes.

userProfile?: XtreamUserProfile

Cached user profile information to avoid repeated API calls. This is populated on first use when needed and contains information about user permissions, allowed formats, etc.

Methods

  • Generates a stream URL for various content types (live channels, movies, TV show episodes).

    This method constructs the appropriate URL based on content type, format, and optional timeshift parameters. It ensures the requested format is allowed for the user.

    Parameters

    • stream: StreamURLRequest

      The stream request parameters

    Returns undefined | string

    The complete streaming URL or undefined if an invalid type is provided

  • Gets the profile information of the authenticated user.

    This includes subscription details, allowed output formats, and other user-specific settings.

    Returns Promise<
        T extends { profile: (input: XtreamUserProfile) => R }
            ? R
            : XtreamUserProfile,
    >

    The user profile information, optionally transformed by custom serializer

  • Gets information about the Xtream server.

    This includes details about the server's time, timezone, and version.

    Returns Promise<
        T extends { serverInfo: (input: XtreamServerInfo) => R }
            ? R
            : XtreamServerInfo,
    >

    Server information, optionally transformed by custom serializer

  • Gets the list of all available live channel categories.

    Categories are used to organize content into groups like Sports, News, Entertainment, etc.

    Returns Promise<
        T extends { channelCategories: (input: XtreamCategory[]) => R }
            ? R
            : XtreamCategory[],
    >

    A list of channel categories, optionally transformed by custom serializer

  • Gets the list of all available movie categories.

    Categories are used to organize content into groups like Action, Comedy, Drama, etc.

    Returns Promise<
        T extends { movieCategories: (input: XtreamCategory[]) => R }
            ? R
            : XtreamCategory[],
    >

    A list of movie categories, optionally transformed by custom serializer

  • Gets the list of all available TV show categories.

    Categories are used to organize content into groups like Drama, Comedy, Documentary, etc.

    Returns Promise<
        T extends { showCategories: (input: XtreamCategory[]) => R }
            ? R
            : XtreamCategory[],
    >

    A list of TV show categories, optionally transformed by custom serializer

  • Gets the list of available live channels, with optional filtering and pagination.

    This method also automatically generates streaming URLs for each channel and adds them to the channel objects.

    Parameters

    • options: FilterableRequest = {}

      Filter and pagination options

      • categoryId

        Optional category ID to filter channels by

      • page

        Optional page number for paginated results

      • limit

        Optional number of items per page

    Returns Promise<
        T extends { channels: (input: XtreamChannel[]) => R }
            ? R
            : XtreamChannel[],
    >

    A list of channels, optionally transformed by custom serializer

  • Gets the list of available movies, with optional filtering and pagination.

    This method also automatically generates streaming URLs for each movie and adds them to the movie objects.

    Parameters

    • options: FilterableRequest = {}

      Filter and pagination options

      • categoryId

        Optional category ID to filter movies by

      • page

        Optional page number for paginated results

      • limit

        Optional number of items per page

    Returns Promise<
        T extends { movies: (input: XtreamMoviesListing[]) => R }
            ? R
            : XtreamMoviesListing[],
    >

    A list of movies, optionally transformed by custom serializer

  • Gets detailed information about a specific movie.

    This includes metadata like plot, cast, director, release date, etc. Also generates and adds the streaming URL to the movie object.

    Parameters

    • options: MovieOptions

      The movie request options

      • movieId

        ID of the movie to retrieve

    Returns Promise<T extends { movie: (input: XtreamMovie) => R } ? R : XtreamMovie>

    Detailed movie information, optionally transformed by custom serializer

    Error if the movie is not found

  • Gets the list of available TV shows, with optional filtering and pagination.

    Parameters

    • options: FilterableRequest = {}

      Filter and pagination options

      • categoryId

        Optional category ID to filter shows by

      • page

        Optional page number for paginated results

      • limit

        Optional number of items per page

    Returns Promise<
        T extends { shows: (input: XtreamShowListing[]) => R }
            ? R
            : XtreamShowListing[],
    >

    A list of TV shows, optionally transformed by custom serializer

  • Gets detailed information about a specific TV show.

    This includes metadata about the show and all its episodes organized by season. Also generates and adds streaming URLs for each episode.

    Parameters

    • options: ShowOptions

      The show request options

      • showId

        ID of the show to retrieve

    Returns Promise<T extends { show: (input: XtreamShow) => R } ? R : XtreamShow>

    Detailed show information, optionally transformed by custom serializer

    Error if the show is not found

  • Gets short EPG (Electronic Program Guide) information for a specific channel.

    Short EPG typically contains programming information for a limited time period.

    Parameters

    • options: EPGOptions

      The EPG request options

      • channelId

        ID of the channel to retrieve EPG for

      • limit

        Optional number of EPG entries to return

    Returns Promise<
        T extends { shortEPG: (input: XtreamShortEPG) => R }
            ? R
            : XtreamShortEPG,
    >

    Short EPG information, optionally transformed by custom serializer

  • Gets full EPG (Electronic Program Guide) information for a specific channel.

    Full EPG contains complete programming information for a longer time period.

    Parameters

    • options: EPGOptions

      The EPG request options

      • channelId

        ID of the channel to retrieve EPG for

    Returns Promise<T extends { fullEPG: (input: XtreamFullEPG) => R } ? R : XtreamFullEPG>

    Full EPG information, optionally transformed by custom serializer