make a couple of changes pr:43

This commit is contained in:
vanilla 2021-09-09 11:15:53 +08:00
parent d3057f34fb
commit 7e61608f79
3 changed files with 68 additions and 45 deletions

View file

@ -29,6 +29,12 @@ import (
func main() {
scraper := twitterscraper.New()
// Cookie and xCsrfToken is optional
// Some specified user tweets are protected that you must login and follow
scraper.WithCookie("twitter cookie after login")
scraper.WithXCsrfToken("twitter X-Csrf-Token after login")
for tweet := range scraper.GetTweets(context.Background(), "Twitter", 50) {
if tweet.Error != nil {
panic(tweet.Error)
@ -167,7 +173,11 @@ func main() {
}
```
### Use http proxy
### Use Proxy
Support http and socks5 proxy
#### with http
```golang
err := scraper.SetProxy("http://localhost:3128")
@ -176,6 +186,15 @@ if err != nil {
}
```
#### with socks5
```golang
err := scraper.SetProxy("socks5://localhost:3128")
if err != nil {
panic(err)
}
```
### Delay requests
Add delay between API requests (in seconds)