Python module and command line script client for http://urbandictionary.com

Overview

py-urbandict

Build Status

py-urbandict is a client for urbandictionary.com.

Project page on github: https://github.com/novel/py-urbandict PyPI: https://pypi.org/project/urbandict/

Installation

Just run:

sudo setup.py install

Usage

To use it from command line, just use 'urbancli' tool like that:

$ urbandicli xterm
1. xterm
  Godly creature, omnipotent, guru in every way imaginable.
  
  Examples:
  
  * I wish i was an xterm

$

Usage from Python:

$ python3.2
Python 3.2 (r32:88445, Feb 27 2011, 09:51:00) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import urbandict
>>> urbandict.define('xterm')
[{'word': 'xterm', 'example': 'I wish i was an xterm', 'def': 'Godly creature, omnipotent, guru in every way imaginable.'}]
>>> 

It returns list of defitinitions for a term. Each list item is a dict with the following keys:

  • word -- the word itself
  • def -- definition of the term
  • example -- example of its usage (could be empty)
Comments
  • Response has [word] followed by unknown

    Response has [word] followed by unknown

    Happens in both the cli and python. For example, if the word is bro it will return Bro unknown. I cant really have it filter out unknown because unknown might be the word and i cant have it filter out everything after the space if its a multiple word query. Besides this, super great module, thank you

    opened by BluCobalt 5
  • Change licence to Unlicense

    Change licence to Unlicense

    Currently there's no license for the py-urbandict project. I was assuming that means that this code is public domain in this case, but it turns out that I'm wrong. As this is a really trivial piece of code, I just want to make it easy for people to use it whatever they want.

    For this purpose I'm considering to license it under the 'Unlicense' http://unlicense.org/.

    I'm adding all the committers here. Please response 'OK' if you agree or share your objections if you have any.

    @notuxic @Kami @sumeet @YorikSar

    Thanks, Roman

    opened by novel 5
  • Original word not returned properly

    Original word not returned properly

    import urbandict urbandict.define('anal') [{'word': 'anal sex', 'def': 'What to avoid in prison.', 'example': 'After dropping my soap, I just let it be so as not to incite an anal rampage.'}, {'word': 'Anal unknown', 'def': 'When a crotch rocket enters the caverns of life.', 'example': 'Sarah to Doug "Will you please take the damn trash out?"Doug "Na playin Fortnite"Sarah "I'll give you Anal!"Doug "ON IT!" (Rockets off Couch)'}, {'word': 'Anal sex', 'def': 'its like having a dick in your ass', 'example': "i've never tried anal...whats it like? it's like having a dick in your ass"}, {'word': 'Anal unknown', 'def': 'Something that may happen when you are trying to lose your virginity but you are too tight and it slips in the wrong hole', 'example': "We couldn't get it in and it slipped causing me to scream wrong hole, and that's the first time I did anal"}, {'word': 'anal sex', 'def': 'Butt sex', 'example': 'Miranda is well known for her wild anal nights.'}, {'word': 'An al unknown', 'def': 'The act of stealing someone else’s mc donalds by accident, going bright red, and blaming it on ur friends who then have to go and get ur meal for you incase you get in trouble', 'example': 'Ah shit that guy is pulling an An Al'}, {'word': 'anal sex', 'def': "bend over and i'll show you.", 'example': '^ what he said ^'}]

    It shouldn't return the word as 'anal unknown' or 'anal sex'. BTW, I think unknown/sex returned is actually a tag associated with the word. Like, 'anal' word has 'sex' tag associated with in red besides it in a few definitions. Probably we can return a separate dictionary mapping for it?

    opened by akhilesh1311 3
  • change in urban dictionary results

    change in urban dictionary results

    http://www.urbandictionary.com/define.php?term=xterm returns html with the word wrapped by an a class="word"

    <a class="word" href="/define.php?term=xterm&amp;defid=227831">xterm</a>
    
    opened by endofline 1
  • support new html markup

    support new html markup

    Currently, urbandict.define("ice") leads to IndexError.

    There is urbandictionary.py that supports new markup. Feel free to integrate it into urbandict.py.

    opened by zed 1
  • please push tag0.2 to master branch, and push that to pip, so the master also works with python2.7

    please push tag0.2 to master branch, and push that to pip, so the master also works with python2.7

    1. I did this: with pyhton 2.7

    pip install py-urbandict installs version 0.1 (not working)

    1. I cloned the master, https://github.com/novel/py-urbandict and installed it manually by copying the .py files over the installed version 0.1

    2. Saw that your master setup.py says still 0.1, but already including the 2.7 fixes

    3. saw that in setup.py is also dependency missing: urllib (and for python 3.X the subpackages?) So maybe you get that dependency fixed and merge that into the master?

    cheers, tverrbjelke

    opened by tverrbjelke 1
  • Doesn't work on Python3.8.5

    Doesn't work on Python3.8.5

    Following your example I wrote:

            import urbandict
            defs = urbandict.define(search)
            print(defs)
            # gives: [{'word': 'xterm', 'def': 'Godly', 'example': 'I wish', 'category': ''}]
    
    

    and not the expected

    [{'word': 'xterm', 'example': 'I wish i was an xterm', 'def': 'Godly creature, omnipotent, guru in every way imaginable.'}]
    
    opened by Buster-2002 2
  • Use real API instead of HTML parsing

    Use real API instead of HTML parsing

    Apparently, urbandictionary has a real API (again):

    http://api.urbandictionary.com/v0/define?term=bebebe https://api.urbandictionary.com/v0/random

    (noticed it here: https://www.npmjs.com/package/urban-dictionary)

    Would be good to add implementation that uses this API. Should probably keep HTML parsing code in case API becomes unavailable again.

    todo 
    opened by novel 2
Owner
Roman Bogorodskiy
Shaolin Shadow Govnocoder
Roman Bogorodskiy
A python script to send sms anonymously with SMS Gateway API. Works on command line terminal.

incognito-sms-sender A python script to send sms anonymously with SMS Gateway API. Works on command line terminal. Download and run script Go to API S

ʀᴇxɪɴᴀᴢᴏʀ 1 Oct 25, 2021
Unirest in Python: Simplified, lightweight HTTP client library.

Unirest for Python Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by Mashape, who also maintain

Kong 432 Dec 21, 2022
A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API.

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API. Amcrest and Dahua devices share similar firmwares. Dahua Cameras and NVRs also work with this module.

Marcelo Moreira de Mello 176 Dec 21, 2022
un outil pour bypasser les code d'états HTTP négatif coté client ( 4xx )

4xxBypasser un outil pour bypasser les code d'états HTTP négatif coté client ( 4xx ) Liscence : MIT license Creator Installation : git clone https://g

null 21 Dec 25, 2022
Python client and module for BGP Ranking

Python client and module for BGP Ranking THis project will make querying BGP Ranking easier. Installation pip install pybgpranking Usage Command line

D4 project 3 Dec 16, 2021
Dns-Client-Server - Dns Client Server For Python

Dns-client-server DNS Server: supporting all types of queries and replies. Shoul

Nishant Badgujar 1 Feb 15, 2022
Raphtory-client - The python client for the Raphtory project

Raphtory Client This is the python client for the Raphtory project Install via p

Raphtory 5 Apr 28, 2022
A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

24 July 2020 Actively soliciting contributers! Ping @ronncc if you would like to help out! pytube pytube is a very serious, lightweight, dependency-fr

pytube 7.9k Jan 2, 2023
JAKYM, Just Another Konsole YouTube-Music. A command line based Youtube music player written in Python with spotify and youtube playlist support

Just Another Konsole YouTube-Music Overview I wanted to create this application so that I could use the command line to play music easily. I often pla

Mayank Jha 73 Jan 1, 2023
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 2, 2022
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 2, 2022
Drcom-pt-client - Drcom Pt version client with refresh timer

drcom-pt-client Drcom Pt version client with refresh timer Dr.com Pt版本客户端 可用于网页认

null 4 Nov 16, 2022
Python wrapper for Xeno-canto API 2.0. Enables downloading bird data with one command line

Python wrapper for Xeno-canto API 2.0. Enables downloading bird data with one command line. Supports multithreading

_zza 9 Dec 10, 2022
Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms INSTALLATION DESCRIPTION OPTIONS CONFIGURATION OUTPUT TEMPLATE FORMAT SELECTION

youtube-dl 116.4k Jan 7, 2023
Command-line program to download image galleries and collections from several image hosting sites

gallery-dl gallery-dl is a command-line program to download image galleries and collections from several image hosting sites (see Supported Sites). It

Mike Fährmann 6.4k Jan 6, 2023
A command line interface for accessing google drive

Drive Cli Get the ability to access Google Drive without leaving your terminal. Inspiration Google Drive has become a vital part of our day to day lif

Chirag Shetty 538 Dec 12, 2022
Slash util - A simple script to add application command support to discord.py v2.0

slash_util is a simple wrapper around slash commands for discord.py This is writ

Maya 28 Nov 16, 2022
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.

domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time

Naufal Ardhani 59 Dec 4, 2022
An Python SDK for QQ based on mirai-api-http v2.

Argon 一个基于 graia-broadcast 和 mirai-api-http v2 的 Python SDK。 本项目适用于 mirai-api-http 2.0 以上版本。 目前仍处于开发阶段,内部接口可能会有较大的变化。 The Stasis / 停滞 为维持 GraiaProject

BlueGlassBlock 1 Oct 29, 2021