Horrible Subs Fetcher
This is a simple library which is able to search, fetch and parse the xdcc packlist of https://xdcc.horriblesubs.info/
Built with ❤︎ by Daniel Belz
Getting started
Fetching all bots
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
var bots = await fetcher.FetchBotListAsync(tokenSource.Token);
foreach (var bot in bots)
Console.WriteLine(bot);
Console.ReadLine();
}
Fetching the packlist of a bot
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
const string bot = "Ginpachi-Sensei";
var packList = await fetcher.FetchBotPackListAsync(bot, tokenSource.Token);
foreach (var item in packList)
Console.WriteLine(item);
Console.ReadLine();
}
Fetching all packlists
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
var packList = await fetcher.FetchPackListsAsync(tokenSource.Token);
foreach (var item in packList)
Console.WriteLine(item);
Console.ReadLine();
}
Finding packs of a bot
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
var bot = "Ginpachi-Sensei";
var packList = await fetcher.FindBotPacksAsync("Toradora", bot, tokenSource.Token);
foreach (var item in packList)
Console.WriteLine(item);
Console.ReadLine();
}
Finding packs
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
var packList = await fetcher.FindPacksAsync("Toradora", tokenSource.Token);
foreach (var item in packList)
Console.WriteLine(item);
Console.ReadLine();
}
Pack ToString
The Pack
class overrides the ToString()
method. It returns a string which can be copy pasted in your favorite irc/xdcc client:
private static async Task Main()
{
var httpClient = new HttpClient();
var fetcher = new Fetcher(httpClient);
var tokenSource = new CancellationTokenSource();
var packList = await fetcher.FetchPackListsAsync(tokenSource.Token);
foreach (var item in packList)
{
// returns: /msg $BOT$ xdcc send #$PACKNUMBER$
Console.WriteLine(item);
}
Console.ReadLine();
}
Contributing
Contributions are always welcome!
Just send me a pull request and I will look at it. If you have more changes please create a issue to discuss it first.
License
This project is licensed under the MIT License - see the LICENSE.md file for details