preserve twitter status ids where possible
This commit is contained in:
parent
f85c7c7654
commit
cda608726d
17
import.go
17
import.go
|
@ -86,14 +86,28 @@ func importTwitter(username, source string) {
|
||||||
sort.Slice(tweets, func(i, j int) bool {
|
sort.Slice(tweets, func(i, j int) bool {
|
||||||
return tweets[i].date.Before(tweets[j].date)
|
return tweets[i].date.Before(tweets[j].date)
|
||||||
})
|
})
|
||||||
|
havetwid := func(xid string) bool {
|
||||||
|
var id int64
|
||||||
|
row := stmtFindXonk.QueryRow(user.ID, xid)
|
||||||
|
err := row.Scan(&id)
|
||||||
|
if err == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, t := range tweets {
|
for _, t := range tweets {
|
||||||
|
xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, t.ID_str)
|
||||||
|
if havetwid(xid) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
what := "honk"
|
what := "honk"
|
||||||
noise := ""
|
noise := ""
|
||||||
if parent := tweetmap[t.In_reply_to_status_id]; parent != nil {
|
if parent := tweetmap[t.In_reply_to_status_id]; parent != nil {
|
||||||
t.convoy = parent.convoy
|
t.convoy = parent.convoy
|
||||||
what = "tonk"
|
what = "tonk"
|
||||||
} else {
|
} else {
|
||||||
t.convoy = "data:,acoustichonkytonk-" + xfiltrate()
|
t.convoy = "data:,acoustichonkytonk-" + t.ID_str
|
||||||
if t.In_reply_to_screen_name != "" {
|
if t.In_reply_to_screen_name != "" {
|
||||||
noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n",
|
noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n",
|
||||||
t.In_reply_to_screen_name, t.In_reply_to_status_id)
|
t.In_reply_to_screen_name, t.In_reply_to_status_id)
|
||||||
|
@ -101,7 +115,6 @@ func importTwitter(username, source string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
audience := []string{thewholeworld}
|
audience := []string{thewholeworld}
|
||||||
xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate())
|
|
||||||
honk := Honk{
|
honk := Honk{
|
||||||
UserID: user.ID,
|
UserID: user.ID,
|
||||||
Username: user.Name,
|
Username: user.Name,
|
||||||
|
|
Loading…
Reference in New Issue