new feature: ignore images in html2text
This commit is contained in:
parent
7cadfb8bd1
commit
f53338c3b1
@ -31,6 +31,7 @@ class Feed(Base):
|
|||||||
readability = Column(Boolean)
|
readability = Column(Boolean)
|
||||||
fullpage = Column(Boolean)
|
fullpage = Column(Boolean)
|
||||||
html2textsummary = Column(Boolean)
|
html2textsummary = Column(Boolean)
|
||||||
|
html2textignoreimages = Column(Boolean)
|
||||||
enabled = Column(Boolean)
|
enabled = Column(Boolean)
|
||||||
|
|
||||||
def __init__(self, url, daily, readability, fullpage, enabled, html2textsummary):
|
def __init__(self, url, daily, readability, fullpage, enabled, html2textsummary):
|
||||||
@ -270,6 +271,8 @@ def process_feed_entry(session, feed, entry):
|
|||||||
print ' converting summary'
|
print ' converting summary'
|
||||||
h2t = html2text.HTML2Text()
|
h2t = html2text.HTML2Text()
|
||||||
h2t.body_width = 0
|
h2t.body_width = 0
|
||||||
|
if feed.html2textignoreimages:
|
||||||
|
h2t.ignore_images = True
|
||||||
summary = thisentry.summary.decode('latin-1')
|
summary = thisentry.summary.decode('latin-1')
|
||||||
summary = h2t.handle(summary)
|
summary = h2t.handle(summary)
|
||||||
thisentry.summary = summary.encode('latin-1', 'replace')
|
thisentry.summary = summary.encode('latin-1', 'replace')
|
||||||
|
Loading…
Reference in New Issue
Block a user