Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2018-02-26 07:26:57 -05:00
parent 95f03afc9d
commit aab0dad8bb
2 changed files with 2 additions and 27 deletions
+1 -15
View File
@@ -74,20 +74,6 @@ Select Elements within Elements:
>>> about.find('a')
[<Element 'a' href='/about/' title='' class=''>, <Element 'a' href='/about/apps/' title=''>, <Element 'a' href='/about/quotes/' title=''>, <Element 'a' href='/about/gettingstarted/' title=''>, <Element 'a' href='/about/help/' title=''>, <Element 'a' href='http://brochure.getpython.info/' title=''>]
Render an Element as Markdown:
.. code-block:: pycon
>>> print(about.markdown)
* [About](/about/)
* [Applications](/about/apps/)
* [Quotes](/about/quotes/)
* [Getting Started](/about/gettingstarted/)
* [Help](/about/help/)
* [Python Brochure](http://brochure.getpython.info/)
Search for text on the page:
.. code-block:: pycon
@@ -120,4 +106,4 @@ Installation
$ pipenv install requests-html
✨🍰✨
Only Python 3 is supported.
Only Python 3 is supported.
+1 -12
View File
@@ -8,8 +8,7 @@ from lxml.html.soupparser import fromstring
from parse import search as parse_search
from parse import findall
# HTML 2 Markdown converter.
html2text = html2text.HTML2Text()
useragent = UserAgent()
@@ -49,11 +48,6 @@ class Element:
"""The full text content (including links) of the element."""
return self.pq.text_content()
@property
def markdown(self):
"""Markdown representation of the element."""
return html2text.handle(self.html)
@property
def html(self):
"""HTML representation of the element."""
@@ -124,11 +118,6 @@ class HTML:
"""Searches the page (multiple times) for the given parse template."""
return [r for r in findall(template, self.html)]
@property
def markdown(self):
"""Markdown representation of the page."""
return html2text.handle(self.html)
@property
def links(self):
"""All found links on page, in asis form."""