ZwoSchlagzeilen Twitter-Bot

2015-10-01 • python, twitter, language processing

@ZwoSchlagzeilen was a Twitter-Bot that mixed recent headlines of leading German newspapers and posts one of them each hour. Sometimes it produced funny results. It was basically the German variant for the American archetype @TwoHeadlines. The bot was discontinued after Twitter was enshittified by Elon Musk and renamed to X. It may have a revival on a successor platform one day.

The script works quite simple. Basically, it uses feedparser to fetch the headlines of several RSS newsfeeds of German newspaper websites. Then, it randomly selects one headline as “seed headline”. An trigram language model is built from all but the seed headline. The seed headline is cut at a random point so that only up to the first half of it is used as seed input for generating a random sequence of words from the trigram model. This sequence of words is the randomly generated headline that is posted to the Twitter account using tweepy.

The source code is a Python script named “zweischlagzeilen” and can be examined in the github repository.

Back