From 3b56973355113f404bce29f876dab19c9a5bed1c Mon Sep 17 00:00:00 2001 From: Alessio Date: Sun, 10 Oct 2021 15:22:48 -0700 Subject: [PATCH] Remove reply-mentions for threads --- scraper/api_types.go | 1 - scraper/api_types_test.go | 4 ++-- scraper/tweet_test.go | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scraper/api_types.go b/scraper/api_types.go index 2063851..c31ba5d 100644 --- a/scraper/api_types.go +++ b/scraper/api_types.go @@ -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 diff --git a/scraper/api_types_test.go b/scraper/api_types_test.go index 643c8bf..bbb1c79 100644 --- a/scraper/api_types_test.go +++ b/scraper/api_types_test.go @@ -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 I’ve 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 { diff --git a/scraper/tweet_test.go b/scraper/tweet_test.go index 73bca1e..d032b07 100644 --- a/scraper/tweet_test.go +++ b/scraper/tweet_test.go @@ -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)