Update tweet UserIDs in a tweet trove with Unknown Users in it (i.e., deleted users(?))
This commit is contained in:
parent
52370a4f9d
commit
5f3013a49b
@ -203,6 +203,12 @@ test $(find link_preview_images | wc -l) = $initial_link_preview_images_count #
|
||||
# test $(sqlite3 twitter.db "select is_stub from tweets where id = 1454522147750260742") = 1
|
||||
|
||||
|
||||
# Test a tweet thread with a deleted account; should generate a user with a fake ID
|
||||
tw fetch_tweet https://twitter.com/michaelmalice/status/1497272681497980928
|
||||
test $(sqlite3 twitter.db "select is_id_fake from users where handle = 'GregCunningham0'") = 1
|
||||
test $(sqlite3 twitter.db "select count(*) from tweets where user_id = (select id from users where handle = 'GregCunningham0')") = 1
|
||||
|
||||
|
||||
# Test search
|
||||
tw search "from:michaelmalice constitution"
|
||||
test $(sqlite3 twitter.db "select count(*) from tweets where user_id = 44067298 and text like '%constitution%'") -gt "30" # Not sure exactly how many
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
* Panics if anything goes wrong.
|
||||
*/
|
||||
func (p Profile) SaveTweetTrove(trove TweetTrove) {
|
||||
for _, u := range trove.Users {
|
||||
for i, u := range trove.Users {
|
||||
// Download download their tiny profile image
|
||||
err := p.DownloadUserProfileImageTiny(&u)
|
||||
if err != nil {
|
||||
@ -22,8 +22,14 @@ func (p Profile) SaveTweetTrove(trove TweetTrove) {
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Error saving user with ID %d and handle %s: %s", u.ID, u.Handle, err.Error()))
|
||||
}
|
||||
fmt.Println(u.Handle, u.ID)
|
||||
// If the User's ID was updated in saving (i.e., Unknown User), update it in the Trove too
|
||||
trove.Users[i] = u
|
||||
}
|
||||
|
||||
// TODO: this is called earlier in the process as well, before parsing. Is that call redundant? Too tired to figure out right now
|
||||
trove.FillMissingUserIDs()
|
||||
|
||||
for _, t := range trove.Tweets {
|
||||
err := p.SaveTweet(t)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user