fixes
This commit is contained in:
@@ -18,16 +18,14 @@ class NerfNowFeedModuleConfig(FeedModuleConfig):
|
||||
def execute(self, bot: TeleBot, chat_id, last_id):
|
||||
if last_id is None:
|
||||
last_id = ''
|
||||
if isinstance(last_id, datetime):
|
||||
last_id = last_id.isoformat()
|
||||
|
||||
feed = feedparser.parse('http://feeds.feedburner.com/nerfnow/full')
|
||||
for e in reversed(feed['entries']):
|
||||
if e['updated'] > last_id:
|
||||
if e['feedburner_origlink'] > last_id:
|
||||
data = e['content'][0]['value'].replace('\n', '')
|
||||
url = IMAGE_RE.search(data).group(1).replace('/large', '')
|
||||
comment = CAPTION_NEWLINE_RE.sub('\n', CAPTION_RE.search(data).group(1))
|
||||
comment = comment.replace('<br />', '')
|
||||
caption = '<b>{}</b>\n\n{}\n\n{}'.format(e['title'], comment, e['feedburner_origlink'])
|
||||
bot.send_photo(chat_id, url, caption, parse_mode='html')
|
||||
yield e['updated']
|
||||
yield e['feedburner_origlink']
|
||||
|
Reference in New Issue
Block a user