Web Scraping library
Project description
Spidar is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.
Quick start
>>> from spidar import Spidar
html_content = '<html><body><p>Some<b>bad<i>HTML</i></b></p></body></html>'
>>> sp = Spidar(html_content, 'html.parser')
>>> print(sp.prettify())
<html>
<body>
<p>
Some
<b>
bad
<i>
HTML
</i>
</b>
</p>
</body>
</html>
>>> sp.find(text="bad")
'bad'
>>> sp.i
<i>HTML</i>
#
>>> sp = Spidar("<p>Some<b>bad<i>HTML")
#
>>> print(sp.prettify())
<html>
<body>
<p>
Some
<b>
bad
<i>
HTML
</i>
</b>
</p>
</body>
</html>
#
>>> sp = Spidar("<tag1>Some<tag2/>bad<tag3>XML", "xml")
#
>>> print(sp.prettify())
<?xml version="1.0" encoding="utf-8"?>
<tag1>
Some
<tag2/>
bad
<tag3>
XML
</tag3>
</tag1>
Running the unit tests
Spidar supports unit test discovery using Pytest:
$ pytest
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
spidar-0.0.1.tar.gz
(124.0 kB
view details)
Built Distribution
spidar-0.0.1-py3-none-any.whl
(145.5 kB
view details)
File details
Details for the file spidar-0.0.1.tar.gz
.
File metadata
- Download URL: spidar-0.0.1.tar.gz
- Upload date:
- Size: 124.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f195101a08a781efc59cf4c384efca5d4f273f0258b3794fd6f8c940b2fe45 |
|
MD5 | ac653b6d597bf5c512ba6e087e5df6b1 |
|
BLAKE2b-256 | 25f713bdc89560ed5994a1cabb8d04196c3150628e8ade81d0467908e71a5f64 |
File details
Details for the file spidar-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: spidar-0.0.1-py3-none-any.whl
- Upload date:
- Size: 145.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91fc3bc9c541444c4948c1bf34aa5af8cf5ae4a64e19370e429e1f2d8460f897 |
|
MD5 | 651e4ccc90b090cc813273870cb2885a |
|
BLAKE2b-256 | 70cab9626deb56b940b23b213aa5464ab0e39c5ac53bf4b17b4e7e2b0f3951a1 |