Added surf http client
- updated Makefile - updated dependencies
This commit is contained in:
+11
-1
@@ -15,6 +15,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/enetx/surf"
|
||||
"github.com/google/go-querystring/query"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
@@ -110,7 +111,16 @@ func newClient() *Client {
|
||||
baseURL, _ := url.Parse(defaultBaseURL)
|
||||
tokenURL, _ := url.Parse(defaultTokenURL)
|
||||
|
||||
client := &Client{client: &http.Client{}, BaseURL: baseURL, TokenURL: tokenURL}
|
||||
surf_client := surf.NewClient().
|
||||
Builder().
|
||||
Impersonate().
|
||||
RandomOS().
|
||||
Firefox().
|
||||
Session().
|
||||
Build().
|
||||
Unwrap()
|
||||
|
||||
client := &Client{client: surf_client.Std(), BaseURL: baseURL, TokenURL: tokenURL}
|
||||
|
||||
client.Account = &AccountService{client: client}
|
||||
client.Collection = &CollectionService{client: client}
|
||||
|
||||
@@ -16,6 +16,7 @@ type StreamService struct {
|
||||
// - a channel into which new posts will be sent
|
||||
// - a channel into which any errors will be sent
|
||||
// - a function that the client can call once to stop the streaming and close the channels
|
||||
//
|
||||
// Because of the 100 post limit imposed by Reddit when fetching posts, some high-traffic
|
||||
// streams might drop submissions between API requests, such as when streaming r/all.
|
||||
func (s *StreamService) Posts(subreddit string, opts ...StreamOpt) (<-chan *Post, <-chan error, func()) {
|
||||
|
||||
Reference in New Issue
Block a user