Remove reply-mentions for threads

This commit is contained in:
Alessio 2021-10-10 15:22:48 -07:00
parent c219652dcc
commit 3b56973355
3 changed files with 4 additions and 5 deletions

View File

@ -129,7 +129,6 @@ func (t *APITweet) NormalizeContent() {
// Handle threads
if (t.InReplyToScreenName != "" && t.Entities.ReplyMentions == "") {
// Identify a "thread" as a tweet that replies to something but there's no leading `@reply` text
t.Entities.ReplyMentions = "@" + t.InReplyToScreenName
}
// Handle pasted tweet links that turn into quote tweets but still have a link in them

View File

@ -25,8 +25,8 @@ func TestNormalizeContent(t *testing.T) {
{"test_responses/single_tweets/tweet_with_at_mentions_in_front.json", "It always does, doesn't it?", 0, 1428907275532476416, 0, "@rob_mose @primalpoly @jmasseypoet @SpaceX"},
{"test_responses/single_tweets/tweet_with_unicode_chars.json", "The fact that @michaelmalice new book The Anarchist Handbook is just absolutely destroying on the charts is the largest white pill Ive swallowed in years.", 0, 0, 0, ""},
{"test_responses/single_tweets/tweet_with_quoted_tweet_as_link.json", "", 1422680899670274048, 0, 0, ""},
{"test_responses/single_tweets/tweet_with_quoted_tweet_as_link2.json", "sometimes they're too dimwitted to even get the wrong title right", 1396194494710788100, 1395882872729477131, 0, "@michaelmalice"},
{"test_responses/single_tweets/tweet_with_quoted_tweet_as_link3.json", "I was using an analogy about creating out-groups but the Germans sure love their literalism", 1442092399358930946, 1335678942020300802, 0, "@michaelmalice"},
{"test_responses/single_tweets/tweet_with_quoted_tweet_as_link2.json", "sometimes they're too dimwitted to even get the wrong title right", 1396194494710788100, 1395882872729477131, 0, ""},
{"test_responses/single_tweets/tweet_with_quoted_tweet_as_link3.json", "I was using an analogy about creating out-groups but the Germans sure love their literalism", 1442092399358930946, 1335678942020300802, 0, ""},
}
for _, v := range test_cases {

View File

@ -77,8 +77,8 @@ func TestParseTweetWithQuotedTweetAsLink(t *testing.T) {
if tweet.InReplyTo != expected_replied_id {
t.Errorf("Expected %q, got %q", expected_replied_id, tweet.InReplyTo)
}
if len(tweet.ReplyMentions) != 1 || tweet.ReplyMentions[0] != "michaelmalice" {
t.Errorf("Wanted %v, got %v", []string{"michaelmalice"}, tweet.ReplyMentions)
if len(tweet.ReplyMentions) != 0 {
t.Errorf("Wanted %v, got %v", []string{}, tweet.ReplyMentions)
}
expected_quoted_id := scraper.TweetID(1396194494710788100)