Skip to main content

betterUD

A better solution to parse definitions from Urban Dictionary for python

Installation

Install betterUD with pip

  pip install betterud

Note: requests are required to run the library, so ensure you've installed it:

  pip install requests

Usage

The library contains two main classes SearchUD and Word. SearchUD has only one function .start() and is used to search words' definitions through Urban Dictionary's API. Returns a list of Word's objects.

Word has arguments .definition, .permalink, .thumbs_up, .author, .word, .defid, .current_vote, .written_on, .example, .thumbs_down:

from betterud import *

definitions = SearchUD('word').start()
print(definitions[0].definition)

Output:

A versatile [declaration], originating (more or less) in hip-hop culture.

"Word" has no single meaning, but is used to convey a casual sense of affirmation, [acknowledgement], agreement, or to indicate that something has impressed you favorably.

Its usage among young blacks has been parodied [ad nauseam] among clueless suburban whites.

Also, Word has a function .bracketless(). This function is used to remove brackets from object's definition and return object itself.

from betterud import *

definitions = SearchUD('word').start()
print(definitions[0].bracketless().definition)

Output:

A versatile declaration, originating (more or less) in hip-hop culture.

"Word" has no single meaning, but is used to convey a casual sense of affirmation, acknowledgement, agreement, or to indicate that something has impressed you favorably.

Its usage among young blacks has been parodied ad nauseam among clueless suburban whites.

If SearchUD didn't get any arguments, it'd return definitions for random words from Urban Dictionary:

from betterud import *

definitions = SearchUD().start()
print(definitions[0].word)

Output:

Came

If SearchUD didn't find a definition, it'd return an empty array:

from betterud import *

definitions = SearchUD('iswearitdoesntexiststhere').start()
print(definitions)

Output:

[]

Credits

Special thanks to atbuy, the creator of python_urbandict as I used his library to understand basics

Metadata

Release files for betterUD 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for betterUD 1.0.2
File Size Uploaded
betterud-1.0.2.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for betterUD 1.0.2
File Interpreter ABI Platform
betterud-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / betterud-1.0.2.tar.gz

Download URL betterud-1.0.2.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4c2e26857eac017e81eda67addb12756feb5388f044a2520b6bc5840ad516f5e
BLAKE2b-256 checksum
How to use checksums
fd67353bc600df15229aa4417a11b84156c60301d6b67f74f3f08b0bf0a0cc7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / betterud-1.0.2-py3-none-any.whl

Download URL betterud-1.0.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b25935cf548cf7692d41a68d3886523b32d3c8cf144bbc2d90b81a797eabbe54
BLAKE2b-256 checksum
How to use checksums
d9faabd1c02dc011f96a4d6c33063ccc20f871b3cafadb8cd414c7183dbbbb6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page