Add authentication

Breaking changes: removed WithCookie and WithXCsrfToken
This commit is contained in:
Alexander Sheiko 2023-04-23 17:32:28 +03:00
parent 3d364abaac
commit eb18988829
7 changed files with 236 additions and 33 deletions

View file

@ -2,6 +2,7 @@ package twitterscraper
import (
"context"
"errors"
"strconv"
)
@ -27,6 +28,10 @@ func SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-cha
// getSearchTimeline gets results for a given search query, via the Twitter frontend API
func (s *Scraper) getSearchTimeline(query string, maxNbr int, cursor string) (*timeline, error) {
if !s.isLogged {
return nil, errors.New("scraper is not logged in for search")
}
if maxNbr > 50 {
maxNbr = 50
}