浏览代码

putting soup info under source

master
Andreas Demmelbauer 6 年前
父节点
当前提交
a8e30c9ad7
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. +3
    -4
      tootbot.py

+ 3
- 4
tootbot.py 查看文件

@@ -247,7 +247,7 @@ for p in reversed(s.entries):
print('Dryrun: not fetching ', pic, ' and not uploading it to mastodon')

poster = p.title.split(']')[0].strip('[')
poster_text = "\n\nvia %s on soup.io" % poster
poster_text = "\n(via %s on soup.io)" % poster
# remove all html stuff - python module in use only supports markdown, not pure plaintext
textsrc = h.handle(p.summary_detail.value.replace("<small>", "<br><small>"))
# free text from lines without visible characters
@@ -269,11 +269,10 @@ for p in reversed(s.entries):
maximumlegth = 500 - 1 - len(poster_text) - len(source) - 50 # 50 ... just in case (if they also count attachement url and so on)
text = (text[:maximumlegth] + '…') if len(text) > maximumlegth else text

# add poster
text += poster_text

# add source
text += source
# add soup poster
text += poster_text

print(text)



正在加载...
取消
保存