diff --git a/pkg/furaffinaty/client.go b/pkg/furaffinaty/client.go index 23f00e2..472ede9 100644 --- a/pkg/furaffinaty/client.go +++ b/pkg/furaffinaty/client.go @@ -115,7 +115,8 @@ func (c *Client) GetSubmissionIDsForFavorites(username string) ([]string, error) err := c.RequestContext.Client.Visit(submissionURL) if err != nil { - return nil, err + log.Println(err) + break } log.Printf("Next Submission URL: %s", nextSubmissionURL) @@ -139,6 +140,7 @@ func (c *Client) GetSubmissionIDsForFavorites(username string) ([]string, error) // GetSubmissions // Set limit to 0 if you want all submissions func (c *Client) GetSubmissions(limit int) ([]models.Submission, error) { + submissionLength := 0 if c.submissionIDs == nil { log.Println("No IDs found, scraping IDs...") @@ -150,13 +152,18 @@ func (c *Client) GetSubmissions(limit int) ([]models.Submission, error) { if limit == 0 { limit = len(c.submissionIDs) + submissionLength = len(c.submissionIDs) + } else { + submissionLength = limit } - for _, id := range c.submissionIDs[:limit] { + for i, id := range c.submissionIDs[:limit] { + log.Printf("Working on submission: %s | Number: %d, from: %d", id, i, submissionLength) submissionURL := fmt.Sprintf("%s/view/%s", c.RequestContext.Host, id) var submission models.Submission submission.ID = id + submission.Url = submissionURL c.RequestContext.Client.OnHTML("#submissionImg", func(e *colly.HTMLElement) { submission.Image.DataFullviewSrc = e.Attr("data-fullview-src")