This repository has been archived on 2018-10-14. You can view files and clone it, but cannot push or open issues or pull requests.
twtxt-registry/update.py

22 lines
456 B
Python

import requests
TWEETFILE = "tweets.txt"
USERFILE = "users.txt"
USERS = []
with open(USERFILE) as f:
USERS = [l.rstrip().split("\t") for l in f if l.rstrip()]
tweets = []
for user in USERS:
r = requests.get(user[1],{"User-Agent":"twtxt-registry/tildeverse"})
if r.status_code!=200:
continue
t = r.text.rstrip().split("\n")
for tx in t:
tweets.append("\t".join([user[0],user[1],tx]))
with open(TWEETFILE,"w") as f:
f.write("\n".join(tweets))