Browse Source

fixing RT line in tweets, adding source for tweets

master
Andreas Demmelbauer 6 years ago
parent
commit
5f134c0a24
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      tootbot.py

+ 3
- 3
tootbot.py View File

@@ -112,9 +112,8 @@ for p in reversed(t.entries):
mastodon_api = register_app(mastuser, mastpasswd, mastinstance, mastodon_api) mastodon_api = register_app(mastuser, mastpasswd, mastinstance, mastodon_api)


c = p.title c = p.title

if p.author != '(%s)' % twitteruser:
c = ("RT %s\n" % p.author[1:-1]) + c
if p.author.lower() != '(@%s)' % twitteruser.lower():
c = ("RT %s from Twitter:\n" % p.author[1:-1]) + c
toot_media = [] toot_media = []
# get the pictures... # get the pictures...
for pic in re.finditer(r"https://pbs.twimg.com/[^ \xa0\"]*", p.summary): for pic in re.finditer(r"https://pbs.twimg.com/[^ \xa0\"]*", p.summary):
@@ -142,6 +141,7 @@ for p in reversed(t.entries):


# remove ellipsis # remove ellipsis
c = c.replace('\xa0…',' ') c = c.replace('\xa0…',' ')
c += '\n\nSource: %s' % p.link
print(c) print(c)


if (not dryrun): if (not dryrun):


Loading…
Cancel
Save