Added surf http client

- updated Makefile
- updated dependencies
This commit is contained in:
2026-01-24 15:16:51 -06:00
parent 8c85da5472
commit 519f3f4f00
5 changed files with 97 additions and 24 deletions
+11 -1
View File
@@ -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}
+1
View File
@@ -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()) {