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"
|
var users = db.getAllRows sql"select * from users"
|
||||||
|
|
||||||
for user in users.items():
|
for user in users.items():
|
||||||
echo user
|
echo "updating " & $user
|
||||||
|
|
||||||
let
|
let
|
||||||
username = user[1]
|
username = user[1]
|
||||||
url = user[2]
|
url = user[2]
|
||||||
tweets = getTweetsFrom(url, username)
|
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
|
sleep 300_000 # 5 minutes
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,6 @@ task db, "SQLite database prompt":
|
||||||
|
|
||||||
task run, "Run app":
|
task run, "Run app":
|
||||||
exec "nimble build"
|
exec "nimble build"
|
||||||
|
exec "./twtxt &"
|
||||||
exec "./twtxtlist"
|
exec "./twtxtlist"
|
||||||
|
exec "killall twtxt"
|
||||||
|
|
Loading…
Reference in New Issue