inital commit
This commit is contained in:
@@ -62,7 +62,7 @@ type BrowseOptions struct {
|
||||
// instead uses GET with ?page=N, which is honoured for the rendered HTML.
|
||||
// "Next page exists?" is inferred from item count: a full page
|
||||
// (browsePerPage items) means we keep going; anything less is the tail.
|
||||
func (c *Client) Browse(ctx context.Context, opts BrowseOptions) iter.Seq2[*Submission, error] {
|
||||
func (c *Client) Browse(ctx context.Context, opts BrowseOptions, reqOpts ...Option) iter.Seq2[*Submission, error] {
|
||||
return func(yield func(*Submission, error) bool) {
|
||||
page := opts.StartPage
|
||||
if page < 1 {
|
||||
@@ -78,7 +78,7 @@ func (c *Client) Browse(ctx context.Context, opts BrowseOptions) iter.Seq2[*Subm
|
||||
err := c.fetch(ctx, pageURL, func(doc *goquery.Document) error {
|
||||
items, _ = parseGalleryPage(doc, c.cfg.jsonListings)
|
||||
return nil
|
||||
})
|
||||
}, reqOpts...)
|
||||
if err != nil {
|
||||
yield(nil, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user