Parsel¶
Parsel is a library to extract data from HTML and XML using XPath and CSS selectors
- Free software: BSD license
- Documentation: https://parsel.readthedocs.org.
Features¶
- Extract text using CSS or XPath selectors
- Regular expression helper methods
Example:
>>> from parsel import Selector
>>> sel = Selector(text=u"""<html>
<body>
<h1>Hello, Parsel!</h1>
<ul>
<li><a href="http://example.com">Link 1</a></li>
<li><a href="http://scrapy.org">Link 2</a></li>
</ul>
</body>
</html>""")
>>>
>>> sel.css('h1::text').get()
'Hello, Parsel!'
>>>
>>> sel.css('h1::text').re('\w+')
['Hello', 'Parsel']
>>>
>>> for e in sel.css('ul > li'):
... print(e.xpath('.//a/@href').get())
http://example.com
http://scrapy.org
Parsel Documentation Contents¶
Contents:
- Installation
- Usage
- History
- 1.5.2 (2019-08-09)
- 1.5.1 (2018-10-25)
- 1.5.0 (2018-07-04)
- 1.4.0 (2018-02-08)
- 1.3.1 (2017-12-28)
- 1.3.0 (2017-12-28)
- 1.2.0 (2017-05-17)
- 1.1.0 (2016-11-22)
- 1.0.3 (2016-07-29)
- 1.0.2 (2016-04-26)
- 1.0.1 (2015-08-24)
- 1.0.0 (2015-08-22)
- 0.9.6 (2015-08-14)
- 0.9.5 (2015-08-11)
- 0.9.4 (2015-08-10)
- 0.9.3 (2015-08-07)
- 0.9.2 (2015-08-07)
- 0.9.1 (2015-08-04)
- 0.9.0 (2015-07-30)