@ZwoSchlagzeilen is a Twitter-Bot that mixes recent headlines of leading German newspapers and posts one of them each hour. Sometimes it produces funny results. It is basically the German variant for the American archetype @TwoHeadlines.
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.