BooruSharp 2.0.3

BooruSharp is a C# library to browse Booru websites (Gelbooru, Konachan, etc...) easily

Install-Package BooruSharp -Version 2.0.3
dotnet add package BooruSharp --version 2.0.3
<PackageReference Include="BooruSharp" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BooruSharp --version 2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Build status
NuGet
codecov
Unit tests
CodeFactor
Nuget

BooruSharp

BooruSharp is a C# library to browse Booru websites easily<br/>
You can download it from NuGet:

Install-Package BooruSharp

BooruSharp currently handle the following websites:

  • booru.allthefallen.moe
  • danbooru.donmai.us
  • e621.net
  • e926.net
  • furry.booru.org
  • gelbooru.com
  • konachan.com
  • lolibooru.moe
  • realbooru.com
  • rule34.xxx
  • safebooru.org
  • sakugabooru.com
  • beta.sankakucomplex.com
  • xbooru.com
  • yande.re

Documentation

Version 2.0.0: https://boorusharp.zirk.eu/<br/>
Version 1.4.8 and below: https://github.com/Xwilarg/BooruSharp/wiki<br/>
Transition from 1.4.8 to 2.0.0: https://boorusharp.zirk.eu/transition.html

Basic examples

Random image:

BooruSharp.Booru.Gelbooru booru = new BooruSharp.Booru.Gelbooru();
BooruSharp.Search.Post.SearchResult result = await booru.GetRandomImageAsync("hibiki_(kantai_collection)", "school_swimsuit");

Console.WriteLine("Image preview URL: " + result.previewUrl + Environment.NewLine +
                  "Image URL: " + result.fileUrl + Environment.NewLine +
                  "Image is safe: " + (result.rating == BooruSharp.Search.Post.Rating.Safe) + Environment.NewLine +
                  "Tags on the image: " + String.Join(", ", result.tags));

Get tag:

BooruSharp.Booru.Safebooru booru = new BooruSharp.Booru.Safebooru();
BooruSharp.Search.Tag.SearchResult result = await booru.GetTagAsync("cirno");

Console.WriteLine("Tag type: " + result.type + Environment.NewLine +
                  "ID: " + result.id);

Get Wiki entry:

BooruSharp.Booru.Konachan booru = new BooruSharp.Booru.Konachan();
BooruSharp.Search.Wiki.SearchResult result = await booru.GetWikiAsync("loli");

Console.WriteLine("Description: " + result.body + Environment.NewLine +
                  "ID: " + result.id + Environment.NewLine +
                  "Created at: " + result.creation.ToString("dd/MM/yy HH:mm:ss") + Environment.NewLine +
                  "Last update at: " + result.lastUpdate.ToString("dd/MM/yy HH:mm:ss"));

Get related tags:

BooruSharp.Booru.Yandere booru = new BooruSharp.Booru.Yandere();
BooruSharp.Search.Related.SearchResult[] results = await booru.GetRelatedAsync("see_through");

Console.WriteLine(String.Join(Environment.NewLine,
    results.Select(delegate (BooruSharp.Search.Related.SearchResult res) { return ("Name: " + res.name +" (" + res.count + ")"); })));

Get comments:

BooruSharp.Booru.Lolibooru booru = new BooruSharp.Booru.Lolibooru();
BooruSharp.Search.Comment.SearchResult[] results = await booru.GetCommentAsync(134097);

Console.WriteLine(String.Join(Environment.NewLine,
    results.Select(delegate (BooruSharp.Search.Comment.SearchResult res) { return ("Author: " + res.authorName + ", the " + res.creation.ToString("dd/MM/yy HH:mm:ss") + " - " + res.body); })));

Advanced examples

Get all character tags containing a string:

BooruSharp.Booru.Yandere yandere = new BooruSharp.Booru.Yandere();
BooruSharp.Search.Tag.SearchResult[] results = await yandere.GetTagsAsync("tsukiko");
Console.WriteLine(String.Join(Environment.NewLine,
	results.Where(delegate (BooruSharp.Search.Tag.SearchResult res) { return (res.type == BooruSharp.Search.Tag.TagType.Character); })
           .Select(delegate (BooruSharp.Search.Tag.SearchResult res) { return (res.name); })));

Need more help?

Feel free to open an issue and come ask on Discord.

Build status
NuGet
codecov
Unit tests
CodeFactor
Nuget

BooruSharp

BooruSharp is a C# library to browse Booru websites easily<br/>
You can download it from NuGet:

Install-Package BooruSharp

BooruSharp currently handle the following websites:

  • booru.allthefallen.moe
  • danbooru.donmai.us
  • e621.net
  • e926.net
  • furry.booru.org
  • gelbooru.com
  • konachan.com
  • lolibooru.moe
  • realbooru.com
  • rule34.xxx
  • safebooru.org
  • sakugabooru.com
  • beta.sankakucomplex.com
  • xbooru.com
  • yande.re

Documentation

Version 2.0.0: https://boorusharp.zirk.eu/<br/>
Version 1.4.8 and below: https://github.com/Xwilarg/BooruSharp/wiki<br/>
Transition from 1.4.8 to 2.0.0: https://boorusharp.zirk.eu/transition.html

Basic examples

Random image:

BooruSharp.Booru.Gelbooru booru = new BooruSharp.Booru.Gelbooru();
BooruSharp.Search.Post.SearchResult result = await booru.GetRandomImageAsync("hibiki_(kantai_collection)", "school_swimsuit");

Console.WriteLine("Image preview URL: " + result.previewUrl + Environment.NewLine +
                  "Image URL: " + result.fileUrl + Environment.NewLine +
                  "Image is safe: " + (result.rating == BooruSharp.Search.Post.Rating.Safe) + Environment.NewLine +
                  "Tags on the image: " + String.Join(", ", result.tags));

Get tag:

BooruSharp.Booru.Safebooru booru = new BooruSharp.Booru.Safebooru();
BooruSharp.Search.Tag.SearchResult result = await booru.GetTagAsync("cirno");

Console.WriteLine("Tag type: " + result.type + Environment.NewLine +
                  "ID: " + result.id);

Get Wiki entry:

BooruSharp.Booru.Konachan booru = new BooruSharp.Booru.Konachan();
BooruSharp.Search.Wiki.SearchResult result = await booru.GetWikiAsync("loli");

Console.WriteLine("Description: " + result.body + Environment.NewLine +
                  "ID: " + result.id + Environment.NewLine +
                  "Created at: " + result.creation.ToString("dd/MM/yy HH:mm:ss") + Environment.NewLine +
                  "Last update at: " + result.lastUpdate.ToString("dd/MM/yy HH:mm:ss"));

Get related tags:

BooruSharp.Booru.Yandere booru = new BooruSharp.Booru.Yandere();
BooruSharp.Search.Related.SearchResult[] results = await booru.GetRelatedAsync("see_through");

Console.WriteLine(String.Join(Environment.NewLine,
    results.Select(delegate (BooruSharp.Search.Related.SearchResult res) { return ("Name: " + res.name +" (" + res.count + ")"); })));

Get comments:

BooruSharp.Booru.Lolibooru booru = new BooruSharp.Booru.Lolibooru();
BooruSharp.Search.Comment.SearchResult[] results = await booru.GetCommentAsync(134097);

Console.WriteLine(String.Join(Environment.NewLine,
    results.Select(delegate (BooruSharp.Search.Comment.SearchResult res) { return ("Author: " + res.authorName + ", the " + res.creation.ToString("dd/MM/yy HH:mm:ss") + " - " + res.body); })));

Advanced examples

Get all character tags containing a string:

BooruSharp.Booru.Yandere yandere = new BooruSharp.Booru.Yandere();
BooruSharp.Search.Tag.SearchResult[] results = await yandere.GetTagsAsync("tsukiko");
Console.WriteLine(String.Join(Environment.NewLine,
	results.Where(delegate (BooruSharp.Search.Tag.SearchResult res) { return (res.type == BooruSharp.Search.Tag.TagType.Character); })
           .Select(delegate (BooruSharp.Search.Tag.SearchResult res) { return (res.name); })));

Need more help?

Feel free to open an issue and come ask on Discord.

Release Notes

Fix bugs with Danbooru and E621

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.3 27 3/24/2020
2.0.2 40 3/24/2020
2.0.1 31 3/23/2020
2.0.0 49 3/21/2020
1.4.8 174 2/21/2020
1.4.7 72 1/31/2020
1.4.6 167 9/24/2019
1.4.4 518 8/1/2019
1.4.3 207 7/13/2019
1.4.2 350 5/30/2019
1.4.1 413 4/8/2019
1.4.0 279 2/27/2019
1.3.6 385 1/10/2019
1.3.5 260 1/5/2019
1.3.3 372 10/17/2018
1.3.1 276 8/21/2018
1.3.0 268 8/14/2018
1.2.0 292 7/31/2018
1.1.1 275 7/30/2018
1.1.0 277 7/27/2018
1.0.1 311 7/22/2018