mirror of
https://github.com/kennethreitz/requests-html.git
synced 2026-06-05 14:50:20 +00:00
+1
-15
@@ -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
@@ -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 as–is form."""
|
||||
|
||||
Reference in New Issue
Block a user