Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Anikeshpatel/dompy
JavaScript Dom Api for Python, Html Parser and a Web scraping tool in python
https://github.com/Anikeshpatel/dompy
dompy html-parser htmlparser javascript-dom-api python3 pythondomapi webscraping
Last synced: 2 months ago
JSON representation
JavaScript Dom Api for Python, Html Parser and a Web scraping tool in python
- Host: GitHub
- URL: https://github.com/Anikeshpatel/dompy
- Owner: Anikeshpatel
- License: gpl-3.0
- Created: 2019-12-12T04:55:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T10:28:08.000Z (about 5 years ago)
- Last Synced: 2024-10-04T09:27:50.314Z (3 months ago)
- Topics: dompy, html-parser, htmlparser, javascript-dom-api, python3, pythondomapi, webscraping
- Language: HTML
- Size: 470 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-html - Anikeshpatel/dompy
- awesome-python-html - Anikeshpatel/dompy
README
JavaScript Dom Api for Python, Html Parser and a Web scraping tool in python
##### Installation
```bash
pip install dompy-parser
```##### Basic API
```python
>>> from dompy import Document
>>> document = Document.fromURL('https://www.lipsum.com')
>>> document.title
'Lorem Ipsum - All the facts - Lipsum generator'
>>> elements = document.getElementsByTag('h3')
>>> len(elements)
5
>>> elements[0].innerHTML
'The standard Lorem Ipsum passage, used since the 1500s'
```**
or
**
```python
>>> from dompy import DompyParser
>>> document = DompyParser.parse('')Abc
Xyz
>>> elements = document.getElementsByTag('h3')
>>> len(elements)
2
>>> elements[0].innerHTML
'Abc'
>>> elements[0].attributes
{'color': 'blue', 'align': 'center'}
```
___#### License
Dompy is GNU GPL v3.0 licensed, as found in the LICENSE file.