Skip to content

Shiroechi/UrbanDictionaryDex

Repository files navigation

UrbanDictionaryDex

API wrapper for Urban Dictionary.

CodeFactor

Download

Nuget

Feature

  • Search a definition of term(s).
  • Search a definition from Urban Dictionary id(s).
  • Get auto complete word from Urban Dictionary.
  • Get a random definitions.

Example

Search a definition of term or word

var client = new UrbanDictionaryClient();
var results = await client.SearchTerm("hentai");
foreach(var item in results)
{
    Console.WriteLine(item.DefId);
    Console.WriteLine(item.Word);
    Console.WriteLine(item.Definition);
    Console.WriteLine();
}

Search a definition of multiple term or word at once

var client = new UrbanDictionaryClient();
var results = await client.SearchTerm(new string[] { "hentai", "anime" });
foreach(var item in results)
{
    Console.WriteLine(item.DefId);
    Console.WriteLine(item.Word);
    Console.WriteLine(item.Definition);
    Console.WriteLine();
}

Get a definition from id

var client = new UrbanDictionaryClient();
var results = await client.SearchTerm(13675580);
foreach(var item in results)
{
    Console.WriteLine(item.DefId);
    Console.WriteLine(item.Word);
    Console.WriteLine(item.Definition);
    Console.WriteLine();
}

Get a definition from multiple id at once

var client = new UrbanDictionaryClient();
var results = await client.SearchTerm(new uint[] { 13675580, 13675581 });
foreach(var item in results)
{
    Console.WriteLine(item.DefId);
    Console.WriteLine(item.Word);
    Console.WriteLine(item.Definition);
    Console.WriteLine();
}

Get random definition

var client = new UrbanDictionaryClient();
var results = await client.GetRandomTerm();
foreach(var item in results)
{
    Console.WriteLine(item.DefId);
    Console.WriteLine(item.Word);
    Console.WriteLine(item.Definition);
    Console.WriteLine();
}