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
defidnamemeaningexampleauthornameurl
dateupvotedownvote
Methods
as_dict()- Converts the dataclass to a
dictobject 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.
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 details)
File details
Details for the file urban_scraper-1.2.tar.gz.
File metadata
- Download URL: urban_scraper-1.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b036eb7450b26d688733eff7e673d29ae2e3dabcb7f8ecb4f64ecc2ff5bf76f
|
|
| MD5 |
f19f79e7cd950ccc5bc6097216ce0ba5
|
|
| BLAKE2b-256 |
3252e4debb919e1a9e290608818225666d964d290d3c5336b60a3d196cdc931e
|