This is the code I use to generate my Tweets page

As of September 2021 it seems to have broken and will need to be retooled along the lines of my archive my tweets project.

import twint
import nest_asyncio
nest_asyncio.apply()


c = twint.Config()

c.Username = 'deepfates'
c.Popular_tweets = True
# c.Limit = 1
c.Min_likes = 130
tweets = []
c.Store_object = True
c.Store_object_tweets_list = tweets


twint.run.Search(c)
tweets.sort(key=lambda x: x.datetime, reverse=True)
from datetime import date

today = date.today()
def get_include(link):
    return('{% include twitter.html '+f'''content='<a href="{link}">{link}</a>' '''+'%}')

def get_md(includes):
    return(f'''---
layout: page
title: Tweets
permalink: /tweets/
---

I post a lot of tweets.

![](/images/bird.jpg)

Here are some of my recent popular posts (not my most popular posts, which I tend to delete when they make me anxious)\n. Last updated {today}
\n
{includes}
''')
includes = '\n\n'.join([get_include(t.link) for t in tweets])
md = get_md(includes)
with open('../_pages/tweets.md', 'w') as f:
    print(md, file=f)