Wraps Pip packages (beautifulsoup and requests) to a more concise content extractor
Project description
Gencon Miner
A general content miner that leverages on Beautiful Soup and Requests to handle extraction. The main goal is to always imagine in terms of targetting parent elements in an HTML form then getting group of tags given that parent.
from gencon_miner import GenconMiner
From URL
url_miner = GenconMiner(url="http://google.com")
txt = url_miner.extract('title')
print(txt[0].text) # Google
From text
text_miner = GenconMiner(text="<p class='myclass'>Hello</p>")
txt = text_miner.extract('.myclass')
print(txt[0].text) # Hello
Convert all tag content to string
Note that contents in a tag will be delimited using newline.
meaning_of_life = """
<p class='myclass'>
Hello
<span>darkness my old friend</span>
</p>
<b>And another one</b>
"""
bulk_miner = GenconMiner(text=meaning_of_life)
bulk_miner.to_text() # Hello\ndarkness my old friend\nAnd another one
Author
Almer Mendoza
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
GenconMiner-0.1.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for GenconMiner-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a381c5d9ddb106363da66f2b9a91d43e5d333194bfcc287c9dbfe183b06f903 |
|
MD5 | 560f55befca43ed9862f735b0503d514 |
|
BLAKE2b-256 | 2c16f2461e128cf97e85c3933ea635a95018e170844875aef72aab9f287f7da7 |