• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H25-Oct-2018-1,8111,202

parsel/H25-Oct-2018-640505

parsel.egg-info/H03-May-2022-257184

tests/H03-May-2022-1,105878

LICENSEH A D25-Oct-20181.5 KiB2822

MANIFEST.inH A D25-Oct-2018237 129

NEWSH A D25-Oct-20184.6 KiB177118

PKG-INFOH A D25-Oct-20188.9 KiB257184

README.rstH A D25-Oct-20181.4 KiB5241

setup.cfgH A D25-Oct-201886 117

setup.pyH A D25-Oct-20182.6 KiB8370

README.rst

1===============================
2Parsel
3===============================
4
5.. image:: https://img.shields.io/travis/scrapy/parsel/master.svg
6   :target: https://travis-ci.org/scrapy/parsel
7   :alt: Build Status
8
9.. image:: https://img.shields.io/pypi/v/parsel.svg
10   :target: https://pypi.python.org/pypi/parsel
11   :alt: PyPI Version
12
13.. image:: https://img.shields.io/codecov/c/github/scrapy/parsel/master.svg
14   :target: http://codecov.io/github/scrapy/parsel?branch=master
15   :alt: Coverage report
16
17
18Parsel is a library to extract data from HTML and XML using XPath and CSS selectors
19
20* Free software: BSD license
21* Documentation: https://parsel.readthedocs.org.
22
23Features
24--------
25
26* Extract text using CSS or XPath selectors
27* Regular expression helper methods
28
29Example::
30
31    >>> from parsel import Selector
32    >>> sel = Selector(text=u"""<html>
33            <body>
34                <h1>Hello, Parsel!</h1>
35                <ul>
36                    <li><a href="http://example.com">Link 1</a></li>
37                    <li><a href="http://scrapy.org">Link 2</a></li>
38                </ul
39            </body>
40            </html>""")
41    >>>
42    >>> sel.css('h1::text').get()
43    'Hello, Parsel!'
44    >>>
45    >>> sel.css('h1::text').re('\w+')
46    ['Hello', 'Parsel']
47    >>>
48    >>> for e in sel.css('ul > li'):
49    ...     print(e.xpath('.//a/@href').get())
50    http://example.com
51    http://scrapy.org
52