#!/usr/bin/env python3

from handler_lib import *
from urllib.request import urlopen, quote as urlquote
from bs4 import BeautifulSoup as BS

args = urlquote(get_args())
url = "https://www.urbandictionary.com/define.php?term={}".format(args)
with urlopen(url) as r:
    bs=BS(r.read(), features="lxml")

title = bs.find("div", attrs={"class": "def-header"}).text.strip()

lines = []
numbered = False
for line in bs.find("div", attrs={"class": "meaning"}).stripped_strings:
    # some definitions have numbered variants in one #meaning
    if re.match(r'^\d\.', line):
        lines.append(line)
        numbered = True
    else:
        if len(lines) == 0:
            lines.append(line)
        else:
            lines[-1] += " " + line

if numbered:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap_single_lines=1)
else:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap=1)

6e504f332139103fa4b325d83512aa81f516a852
<mask token>

<mask token>
with urlopen(url) as r:
    bs = BS(r.read(), features='lxml')
<mask token>
for line in bs.find('div', attrs={'class': 'meaning'}).stripped_strings:
    if re.match('^\\d\\.', line):
        lines.append(line)
        numbered = True
    elif len(lines) == 0:
        lines.append(line)
    else:
        lines[-1] += ' ' + line
if numbered:
    handler_exit(0, lines=lines, link=url, title=title, box=1,
        wrap_single_lines=1)
else:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap=1)

<mask token>
args = urlquote(get_args())
url = 'https://www.urbandictionary.com/define.php?term={}'.format(args)
with urlopen(url) as r:
    bs = BS(r.read(), features='lxml')
title = bs.find('div', attrs={'class': 'def-header'}).text.strip()
lines = []
numbered = False
for line in bs.find('div', attrs={'class': 'meaning'}).stripped_strings:
    if re.match('^\\d\\.', line):
        lines.append(line)
        numbered = True
    elif len(lines) == 0:
        lines.append(line)
    else:
        lines[-1] += ' ' + line
if numbered:
    handler_exit(0, lines=lines, link=url, title=title, box=1,
        wrap_single_lines=1)
else:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap=1)

from handler_lib import *
from urllib.request import urlopen, quote as urlquote
from bs4 import BeautifulSoup as BS
args = urlquote(get_args())
url = 'https://www.urbandictionary.com/define.php?term={}'.format(args)
with urlopen(url) as r:
    bs = BS(r.read(), features='lxml')
title = bs.find('div', attrs={'class': 'def-header'}).text.strip()
lines = []
numbered = False
for line in bs.find('div', attrs={'class': 'meaning'}).stripped_strings:
    if re.match('^\\d\\.', line):
        lines.append(line)
        numbered = True
    elif len(lines) == 0:
        lines.append(line)
    else:
        lines[-1] += ' ' + line
if numbered:
    handler_exit(0, lines=lines, link=url, title=title, box=1,
        wrap_single_lines=1)
else:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap=1)

#!/usr/bin/env python3

from handler_lib import *
from urllib.request import urlopen, quote as urlquote
from bs4 import BeautifulSoup as BS

args = urlquote(get_args())
url = "https://www.urbandictionary.com/define.php?term={}".format(args)
with urlopen(url) as r:
    bs=BS(r.read(), features="lxml")

title = bs.find("div", attrs={"class": "def-header"}).text.strip()

lines = []
numbered = False
for line in bs.find("div", attrs={"class": "meaning"}).stripped_strings:
    # some definitions have numbered variants in one #meaning
    if re.match(r'^\d\.', line):
        lines.append(line)
        numbered = True
    else:
        if len(lines) == 0:
            lines.append(line)
        else:
            lines[-1] += " " + line

if numbered:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap_single_lines=1)
else:
    handler_exit(0, lines=lines, link=url, title=title, box=1, wrap=1)
