From b3a3f4936a37e3571fa2b26da821aa986164a5cd Mon Sep 17 00:00:00 2001 From: gaarder Date: Mon, 20 Jan 2025 06:20:29 +1100 Subject: [PATCH 1/4] Update vrphub.go for Duration --- pkg/scrape/vrphub.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/scrape/vrphub.go b/pkg/scrape/vrphub.go index b140f04cf..ba8473f50 100644 --- a/pkg/scrape/vrphub.go +++ b/pkg/scrape/vrphub.go @@ -7,6 +7,7 @@ import ( "path" "regexp" "strings" + "strconv" "github.com/gocolly/colly/v2" "github.com/nleeper/goment" @@ -132,6 +133,20 @@ func VRPHub(wg *models.ScrapeWG, updateSite bool, knownScenes []string, out chan // Duration sc.Duration = 0 + reDuration := regexp.MustCompile(`^WATCH FULL VIDEO ([0-9}+:*[0-9}*) MIN$`) + e.ForEach(`maxbutton-7 maxbutton maxbutton-get-the-full-video-now`, func(id int, e *colly.HTMLElement) { + tmpDuration, err := reDuration.FindStringSubmatch(e.Text) + if err != nil { + return + } + if tmpDuration != null { + intDuration, err := strconv.Atoi(strings.Split(tmpDuration[1],":")[0]) + if err != nil { + sc.Duration = intDuration + return + } + } + }) // There are 2 places we can find filenames from - one is in the video // previews, and one is in the trailer download section. Some posts From 306c77944f46f846a787c03ad48a80cb833d4d76 Mon Sep 17 00:00:00 2001 From: gaarder Date: Mon, 20 Jan 2025 15:45:26 +1100 Subject: [PATCH 2/4] Update vrphub.go video duration --- pkg/scrape/vrphub.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/scrape/vrphub.go b/pkg/scrape/vrphub.go index ba8473f50..e25a7ca4c 100644 --- a/pkg/scrape/vrphub.go +++ b/pkg/scrape/vrphub.go @@ -133,17 +133,13 @@ func VRPHub(wg *models.ScrapeWG, updateSite bool, knownScenes []string, out chan // Duration sc.Duration = 0 - reDuration := regexp.MustCompile(`^WATCH FULL VIDEO ([0-9}+:*[0-9}*) MIN$`) - e.ForEach(`maxbutton-7 maxbutton maxbutton-get-the-full-video-now`, func(id int, e *colly.HTMLElement) { - tmpDuration, err := reDuration.FindStringSubmatch(e.Text) - if err != nil { - return - } - if tmpDuration != null { + reDuration := regexp.MustCompile(`^WATCH FULL VIDEO ([0-9]+:*[0-9]*) MIN$`) + e.ForEach(`a.maxbutton-get-the-full-video-now`, func(id int, e *colly.HTMLElement) { + tmpDuration := reDuration.FindStringSubmatch(e.Text) + if tmpDuration != nil { intDuration, err := strconv.Atoi(strings.Split(tmpDuration[1],":")[0]) - if err != nil { + if err == nil { sc.Duration = intDuration - return } } }) From 58927e79191f9e8e1686235fb5894d4e0f8939e4 Mon Sep 17 00:00:00 2001 From: gaarder Date: Tue, 21 Jan 2025 06:28:54 +1100 Subject: [PATCH 3/4] gofmt --- pkg/scrape/vrphub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/scrape/vrphub.go b/pkg/scrape/vrphub.go index e25a7ca4c..4e6719598 100644 --- a/pkg/scrape/vrphub.go +++ b/pkg/scrape/vrphub.go @@ -137,7 +137,7 @@ func VRPHub(wg *models.ScrapeWG, updateSite bool, knownScenes []string, out chan e.ForEach(`a.maxbutton-get-the-full-video-now`, func(id int, e *colly.HTMLElement) { tmpDuration := reDuration.FindStringSubmatch(e.Text) if tmpDuration != nil { - intDuration, err := strconv.Atoi(strings.Split(tmpDuration[1],":")[0]) + intDuration, err := strconv.Atoi(strings.Split(tmpDuration[1], ":")[0]) if err == nil { sc.Duration = intDuration } From 2c5c627184d24fcd3a8d1f193da397d7316515ab Mon Sep 17 00:00:00 2001 From: gaarder Date: Tue, 21 Jan 2025 06:30:26 +1100 Subject: [PATCH 4/4] gofmt2