update readme
This commit is contained in:
parent
341e1de6d0
commit
8c930602c1
2 changed files with 22 additions and 1 deletions
21
README.md
21
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.
|
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.
|
See [Rules and filtering](https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators) for build standard queries.
|
||||||
|
|
|
||||||
2
util.go
2
util.go
|
|
@ -13,7 +13,7 @@ import (
|
||||||
//HttpProxy Public variable for Http proxy
|
//HttpProxy Public variable for Http proxy
|
||||||
var HTTPProxy *url.URL
|
var HTTPProxy *url.URL
|
||||||
|
|
||||||
//SetProxy set http proxy
|
//SetProxy set http proxy format `http://HOST:PORT`
|
||||||
func SetProxy(Proxy string) error {
|
func SetProxy(Proxy string) error {
|
||||||
match, _ := regexp.MatchString("http.+", Proxy)
|
match, _ := regexp.MatchString("http.+", Proxy)
|
||||||
if !match {
|
if !match {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue