Easy to use Urban Dictionary asynchronous and synchronous scraper.
Project description
Asynchronous and Synchronous Urban Dictionary Scraper
It uses selectolax to parse the HTML and httpx for sending HTTP requests.
Asynchronous Example
import asyncio
from urban_scraper import adefine
async def main():
definitions = await adefine('hello')
async for definition in definitions:
...
asyncio.run(main())
Synchronous Example
from urban_scraper import define
definitions = define('hello')
for definition in definitions:
...
In both examples, definition
is urban_scraper.Definition
Attributes and Methods of urban_scraper.Definition
Attributes
defid
name
meaning
example
author
name
url
date
upvote
downvote
Methods
as_dict()
- Converts the dataclass to a
dict
object and returns it.
- Converts the dataclass to a
How To Install
- Using pip:
pip install urban-scraper
- Manual:
- Clone the folder somewhere
- CD to the location
- Install the packages listed in
requirements.txt
(pip install -r requirements.txt
) - Copy the folder, urban_scraper where you want to use it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
urban_scraper-1.2.tar.gz
(4.7 kB
view hashes)