From ed0a19c7de342e58053150821d8e9a9b054b57af Mon Sep 17 00:00:00 2001 From: Alexander Sheiko Date: Sun, 7 May 2023 17:46:01 +0300 Subject: [PATCH] Fix search again --- search_test.go | 6 ++---- util.go | 9 --------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/search_test.go b/search_test.go index 86e8048..fa43afc 100644 --- a/search_test.go +++ b/search_test.go @@ -3,7 +3,6 @@ package twitterscraper_test import ( "context" "os" - "strings" "testing" twitterscraper "github.com/n0madic/twitter-scraper" @@ -31,9 +30,6 @@ func TestFetchSearchCursor(t *testing.T) { if err != nil { t.Fatal(err) } - if strings.HasPrefix(cursor, "scroll:") { - continue - } if cursor == "" { t.Fatal("Expected search cursor is empty") } @@ -50,6 +46,7 @@ func TestGetSearchProfiles(t *testing.T) { if err != nil { t.Fatal(err) } + searchScraper.SetSearchMode(twitterscraper.SearchUsers) for profile := range searchScraper.SearchProfiles(context.Background(), "Twitter", maxProfilesNbr) { if profile.Error != nil { t.Error(profile.Error) @@ -79,6 +76,7 @@ func TestGetSearchTweets(t *testing.T) { if err != nil { t.Fatal(err) } + searchScraper.SetSearchMode(twitterscraper.SearchLatest) for tweet := range searchScraper.SearchTweets(context.Background(), "twitter", maxTweetsNbr) { if tweet.Error != nil { t.Error(tweet.Error) diff --git a/util.go b/util.go index 5de9c89..4cc9e49 100644 --- a/util.go +++ b/util.go @@ -5,7 +5,6 @@ import ( "net/http" "regexp" "strconv" - "strings" "time" ) @@ -82,10 +81,6 @@ func getUserTimeline(ctx context.Context, query string, maxProfilesNbr int, fetc break } - if strings.HasPrefix(next, "scroll:") { - continue - } - for _, profile := range profiles { select { case <-ctx.Done(): @@ -131,10 +126,6 @@ func getTweetTimeline(ctx context.Context, query string, maxTweetsNbr int, fetch break } - if strings.HasPrefix(next, "scroll:") { - continue - } - for _, tweet := range tweets { select { case <-ctx.Done():