diff --git a/README.md b/README.md index b03d9fc..5b3a2d5 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,28 @@ func main() { } } ``` +#### With http proxy +```golang +package main + +import ( + "context" + "fmt" + twitterscraper "github.com/n0madic/twitter-scraper" +) + +func main() { + twitterscraper.SetProxy("http://localhost:16379") + for tweet := range twitterscraper.SearchTweets(context.Background(), + "twitter scraper data -filter:retweets", 50) { + if tweet.Error != nil { + panic(tweet.Error) + } + fmt.Println(tweet.HTML) + } +} +``` The search ends if we have 50 tweets. See [Rules and filtering](https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators) for build standard queries. diff --git a/util.go b/util.go index 058f746..155d0e0 100644 --- a/util.go +++ b/util.go @@ -13,7 +13,7 @@ import ( //HttpProxy Public variable for Http proxy var HTTPProxy *url.URL -//SetProxy set http proxy +//SetProxy set http proxy format `http://HOST:PORT` func SetProxy(Proxy string) error { match, _ := regexp.MatchString("http.+", Proxy) if !match {