Last Updated: February 25, 2016
·
3.858K
· sergiotapia

Streamtastic - Own3d and Twich.tv C# API library.

So I made this during the weekend, it's a simple to use C# library that developers can use to list streams for any particular game on any platform that supports .NET and C#.

I've tested this on a desktop app, a web application and a Windows Phone 7 applications, and everything runs very well.

Github: https://github.com/sergiotapia/Streamtastic

Example usage:

Streamtastic - eSports Streaming Library

Streamtastic is a .NET (C#) library that provides information for streams hosted on a wide variety of websites including Own3d and Twitch.tv API.

Just invoke Streamtastic methods, and you are returned simple to use C# POCO classes. Couldn't be easier!

How Do You Use It?

It's dead simple! Since you work against interfaces, you only have to inject the dependancy you want and no more changes to your code are needed.

Own3d Examples:

StreamFinder own3dStreamtastic = new StreamFinder(new Own3dStreamRepository());

// Let's find the most viewed streamers in general.
var topStreamers = own3dStreamtastic.FindTopViewedStreams();
foreach (var stream in topStreamers)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

// You can find the top viewed streamers for any game Own3d supports.
// For example, League of Legends.
var topStreamersForLeagueOfLegends = own3dStreamtastic.FindTopViewedStreamsByGame("League+of+Legends");
foreach (var stream in topStreamersForLeagueOfLegends)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

// Or how about Dota 2.
var topStreamersForDota2 = own3dStreamtastic.FindTopViewedStreamsByGame("Dota+2");
foreach (var stream in topStreamersForDota2)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

Twitch.TV Examples:

StreamFinder twitchTv = new StreamFinder(new TwitchtvStreamRepository());

// Let's find the most viewed streamers in general.
var topStreamers = twitchTv.FindTopViewedStreams();
foreach (var stream in topStreamers)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

// You can find the top viewed streamers for any game Own3d supports.
// For example, League of Legends.
var topStreamersForLeagueOfLegends = twitchTv.FindTopViewedStreamsByGame("League of Legends");
foreach (var stream in topStreamersForLeagueOfLegends)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

// Or how about Dota 2.
var topStreamersForDota2 = twitchTv.FindTopViewedStreamsByGame("Dota 2");
foreach (var stream in topStreamersForDota2)
{
    Console.WriteLine(String.Format("{0} - Viewers: {1}", stream.Title, stream.ViewerCount));
}

How Does This Work?

Where a native API is implemented, we use that. However some websites do not offer an API; in those cases I just parse some HTML using
HTMLAgilityPack and ScrappySharp.