Skip to content

Commit

Permalink
Fix search again
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Sheiko committed May 7, 2023
1 parent 61f2b78 commit ed0a19c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package twitterscraper_test
import (
"context"
"os"
"strings"
"testing"

twitterscraper "github.com/n0madic/twitter-scraper"
Expand Down Expand Up @@ -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")
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 0 additions & 9 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http"
"regexp"
"strconv"
"strings"
"time"
)

Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit ed0a19c

Please sign in to comment.