A .NET 9 client library for Xtream API, providing a simple and efficient way to interact with Xtream-based IPTV services.
- 🚀 Simple and intuitive API
- 🔧 Configurable HTTP client with User-Agent support
- 📦 .NET 9 compatible
- ✅ Comprehensive test coverage
- 🔐 Support for URL-based and basic authentication
- .NET 9.0 SDK or later
dotnet add package Xtream.Clientusing(var xtreamClient = new XtreamClient(DefaultHttpClientFactory.Default))
{
var connectionInfo = new XtUrlConnectionFactory(url).Create();
// Get Panel Info
var panelInfo = await xtreamClient.GetPanelAsync(connectionInfo, CancellationToken.None);
// Get Server and user info
var allInfos = await xtreamClient.GetUserAndServerInfoAsync(connectionInfo, CancellationToken.None);
// Get live streams
var livestreams = await xtreamClient.GetLiveStreamsAsync(connectionInfo, CancellationToken.None);
// Get VOD streams
var vods = await xtreamClient.GetVodStreamsAsync(connectionInfo, CancellationToken.None);
}using(var xtreamClient = new XtreamClient(DefaultHttpClientFactory.Default))
{
var connectionInfo = new XtBasicConnectionFactory(server, username, password).Create();
// Get Panel Info
var panelInfo = await xtreamClient.GetPanelAsync(connectionInfo, CancellationToken.None);
// Get Server and user info
var allInfos = await xtreamClient.GetUserAndServerInfoAsync(connectionInfo, CancellationToken.None);
// Get live streams
var livestreams = await xtreamClient.GetLiveStreamsAsync(connectionInfo, CancellationToken.None);
// Get VOD streams
var vods = await xtreamClient.GetVodStreamsAsync(connectionInfo, CancellationToken.None);
}Some providers require specific User-Agent headers. You can customize the User-Agent:
// Using a custom User-Agent
var factory = new DefaultHttpClientFactory("MyApp/2.0");
using(var xtreamClient = new XtreamClient(factory))
{
var connectionInfo = new XtUrlConnectionFactory(url).Create();
var panelInfo = await xtreamClient.GetPanelAsync(connectionInfo, CancellationToken.None);
}The default User-Agent is "XtreamClient/1.0". This helps prevent 401 errors from providers that require a User-Agent header.
Implement IHttpClientFactory for advanced scenarios like custom headers, proxy configuration, or timeout settings:
public class CustomHttpClientFactory : IHttpClientFactory
{
public HttpClient Create()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("User-Agent", "MyCustomAgent/1.0");
client.Timeout = TimeSpan.FromSeconds(30);
return client;
}
}
var xtreamClient = new XtreamClient(new CustomHttpClientFactory());The XtreamClient provides the following methods:
GetPanelAsync()- Get complete panel informationGetUserAndServerInfoAsync()- Get server and user detailsGetLiveStreamsAsync()- Get all live streamsGetLiveStreamsByCategoriesAsync()- Get live streams filtered by categoryGetLiveCategoriesAsync()- Get all live stream categoriesGetVodStreamsAsync()- Get all VOD streamsGetAllEpgAsync()- Get electronic program guide dataGetShortEpgForStreamAsync()- Get EPG for a specific streamGetXmltvAsync()- Get XMLTV format EPG data
Contributions are welcome! Please feel free to submit a Pull Request.
For AI-assisted contributions, see AGENTS.md for guidelines.
This project is licensed under the MIT License.
If you encounter any issues or have questions, please open an issue on GitHub.