inital commit
This commit is contained in:
@@ -115,7 +115,7 @@ type SearchOptions struct {
|
||||
// Search works anonymously for most queries; some adult-content searches
|
||||
// require login and will surface as [ErrUnauthorized] via the system-
|
||||
// message classifier.
|
||||
func (c *Client) Search(ctx context.Context, query string, opts SearchOptions) iter.Seq2[*Submission, error] {
|
||||
func (c *Client) Search(ctx context.Context, query string, opts SearchOptions, reqOpts ...Option) iter.Seq2[*Submission, error] {
|
||||
return func(yield func(*Submission, error) bool) {
|
||||
page := opts.StartPage
|
||||
if page < 1 {
|
||||
@@ -134,7 +134,7 @@ func (c *Client) Search(ctx context.Context, query string, opts SearchOptions) i
|
||||
err := c.fetch(ctx, pageURL, func(doc *goquery.Document) error {
|
||||
items, hasNext = parseSearchResults(doc, c.cfg.jsonListings)
|
||||
return nil
|
||||
})
|
||||
}, reqOpts...)
|
||||
if err != nil {
|
||||
yield(nil, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user