Browse Source

Update tooter for shorter metadata and English links

main
Mark Cornick 2 months ago
parent
commit
b94f73283e
  1. 6
      tooter.py

6
tooter.py

@ -11,13 +11,11 @@ def toot_most_recent(section, include_text=False):
['hugo', 'list', 'all'], stdout=subprocess.PIPE
).stdout.decode('utf-8'))
posts = [p for p in csv.DictReader(stream) if re.match(
r'^content/{}'.format(section),
p['path']
)]
r'^https://mcornick.com/{}/'.format(section), p['permalink'])]
last_post = sorted(posts, key=lambda p: p['date'])[-1]
status = "{}: {}".format(last_post['title'], last_post['permalink'])
if include_text:
text = ''.join(open(last_post['path']).readlines()[13:])
text = ''.join(open(last_post['path']).readlines()[7:])
status += '\n\n{}'.format(text)
token = open('usercred.secret').read().strip()
url = 'https://tilde.zone/api/v1/statuses'

Loading…
Cancel
Save