add scraped tweets to the database
This commit is contained in:
parent
ec4dab6953
commit
829371ccbd
|
@ -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
|
||||
|
||||
|
|
|
@ -18,4 +18,6 @@ task db, "SQLite database prompt":
|
|||
|
||||
task run, "Run app":
|
||||
exec "nimble build"
|
||||
exec "./twtxt &"
|
||||
exec "./twtxtlist"
|
||||
exec "killall twtxt"
|
||||
|
|
Loading…
Reference in New Issue