add scraped tweets to the database

This commit is contained in:
Christine Dodrill 2016-02-06 08:48:10 -08:00
parent ec4dab6953
commit 829371ccbd
2 changed files with 8 additions and 2 deletions

View File

@ -59,13 +59,17 @@ proc updateTweets*() =
var users = db.getAllRows sql"select * from users"
for user in users.items():
echo user
echo "updating " & $user
let
username = user[1]
url = user[2]
tweets = getTweetsFrom(url, username)
echo tweets
for tweet in tweets.items():
try:
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds(), tweet.message)
except: discard
sleep 300_000 # 5 minutes

View File

@ -18,4 +18,6 @@ task db, "SQLite database prompt":
task run, "Run app":
exec "nimble build"
exec "./twtxt &"
exec "./twtxtlist"
exec "killall twtxt"