Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lorien/selection
API to extract data from HTML and XML documents
https://github.com/lorien/selection
dom html lxml query-api xml xpath xpath-api
Last synced: 3 months ago
JSON representation
API to extract data from HTML and XML documents
- Host: GitHub
- URL: https://github.com/lorien/selection
- Owner: lorien
- License: mit
- Created: 2015-02-08T20:30:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T23:36:19.000Z (about 2 years ago)
- Last Synced: 2024-08-11T00:47:53.043Z (6 months ago)
- Topics: dom, html, lxml, query-api, xml, xpath, xpath-api
- Language: Python
- Size: 126 KB
- Stars: 9
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Selection Documenation
[![Tests](https://github.com/lorien/selection/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/test.yml)
[![Code Quality](https://github.com/lorien/selection/actions/workflows/code_quality.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/code_quality.yml)
[![Typing](https://github.com/lorien/selection/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/selection/actions/workflows/mypy.yml)
[![Test coverage](https://coveralls.io/repos/lorien/selection/badge.svg?branch=master)](https://coveralls.io/r/lorien/selection?branch=master)API to query DOM tree of HTML/XML document.
## Usage Example
```
from selection import XpathSelector
from lxml.html import fromstringhtml = '
'test
- 1
- 2
sel = XpathSelector(fromstring(html))
print(sel.select('//h1')).text()
print(sel.select('//li').text_list()
print(sel.select('//ul').attr('id')
```## Installation
Run: `pip install -U selection`
## Community
Telegram English chat: [https://t.me/grablab](https://t.me/grablab)
Telegram Russian chat: [https://t.me/grablab\_ru](https://t.me/grablab_ru)