Fix unusual bug when scraping tweets which only happens if the tweet has a link and the text is exactly 22 chars long
This commit is contained in:
parent
a0a32d0fb8
commit
5cbf96f379
@ -202,6 +202,10 @@ func (t *APITweet) NormalizeContent() {
|
||||
// Handle short links showing up at ends of tweets
|
||||
for _, url := range t.Entities.URLs {
|
||||
index := strings.Index(t.FullText, url.ShortenedUrl)
|
||||
if index < 0 {
|
||||
// It's not in the text
|
||||
continue
|
||||
}
|
||||
if index == (len(t.FullText) - len(url.ShortenedUrl)) {
|
||||
t.FullText = strings.TrimSpace(t.FullText[0:index])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user