diff --git a/feedbot.py b/feedbot.py index 8e8645b..d70fe2c 100644 --- a/feedbot.py +++ b/feedbot.py @@ -1,8 +1,10 @@ import feedparser import requests +import textwrap import logging import pnutpy import click +import time import re import os @@ -126,6 +128,19 @@ def pnutpost(entry, source, token): rx = re.compile('<.*?>') text = re.sub(rx, '', entry.summary) + lchk = textwrap.wrap(text, 256) + if len(lchk) > 1: + pretext = textwrap.wrap(text, 250) + longpost = { + 'type': "nl.chimpnut.blog.post", + 'value': { + 'body': text, + 'tstamp': time.time() * 1000 + } + } + raw.append(longpost) + text = pretext + " [...](" + entry.link + ")" + if dr: logging.info({'text': text, 'raw': raw}) else: