From 6ece0fda99dfc4296a89f1b9fac073eec6acbbd7 Mon Sep 17 00:00:00 2001 From: toshski Date: Fri, 14 Apr 2023 06:39:39 +1200 Subject: [PATCH 1/3] Fix VRHush Tilt and Cover Image --- pkg/scrape/vrhush.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/scrape/vrhush.go b/pkg/scrape/vrhush.go index b8baba91d..41cc9d052 100644 --- a/pkg/scrape/vrhush.go +++ b/pkg/scrape/vrhush.go @@ -44,9 +44,11 @@ func VRHush(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan< reGetOriginal := regexp.MustCompile(`^(https?:\/\/b8h6h9v9\.ssl\.hwcdn\.net\/vrh\/)(?:largethumbs|hugethumbs|rollover_large|rollover_huge)(\/.+)-c\d{3,4}x\d{3,4}(\.\w{3,4})$`) // Title / Cover - e.ForEach(`deo-video`, func(id int, e *colly.HTMLElement) { - sc.Title = strings.TrimSpace(e.Attr("title")) - sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("cover-image"))) + e.ForEach(`.latest-scene-title`, func(id int, e *colly.HTMLElement) { + sc.Title = strings.TrimSpace(e.Text) + }) + e.ForEach(`web-vr-video-player`, func(id int, e *colly.HTMLElement) { + sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("coverimage"))) }) // Gallery From 6a4bb1b09ccafd38ad2c7ad24477e99b6eeb826d Mon Sep 17 00:00:00 2001 From: toshski Date: Fri, 14 Apr 2023 07:15:19 +1200 Subject: [PATCH 2/3] Fix Trailer Source & migrate existing scenes --- pkg/migrations/migrations.go | 8 ++++++++ pkg/scrape/vrhush.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/migrations/migrations.go b/pkg/migrations/migrations.go index ca1245dd3..494282ae7 100644 --- a/pkg/migrations/migrations.go +++ b/pkg/migrations/migrations.go @@ -1460,6 +1460,14 @@ func Migrate() { return nil }, }, + { + // rebuild search indexes with new fields + ID: "0061-fix-vrhush-trailers", + Migrate: func(tx *gorm.DB) error { + sql := `update scenes set trailer_source = replace(trailer_source, 'deo-video source', 'web-vr-video-player source') where scraper_id = 'vrhush'` + return tx.Exec(sql).Error + }, + }, }) if err := m.Migrate(); err != nil { diff --git a/pkg/scrape/vrhush.go b/pkg/scrape/vrhush.go index 41cc9d052..54e0c5c2b 100644 --- a/pkg/scrape/vrhush.go +++ b/pkg/scrape/vrhush.go @@ -87,7 +87,7 @@ func VRHush(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan< // trailer details sc.TrailerType = "scrape_html" - params := models.TrailerScrape{SceneUrl: sc.HomepageURL, HtmlElement: "deo-video source", ContentPath: "src", QualityPath: "quality", ContentBaseUrl: "https:"} + params := models.TrailerScrape{SceneUrl: sc.HomepageURL, HtmlElement: "web-vr-video-player", ContentPath: "src", QualityPath: "quality", ContentBaseUrl: "https:"} strParams, _ := json.Marshal(params) sc.TrailerSrc = string(strParams) From 30f94596d16fe5725f1a750c47faaabfb576f151 Mon Sep 17 00:00:00 2001 From: toshski Date: Fri, 14 Apr 2023 09:13:03 +1200 Subject: [PATCH 3/3] Same change for vrallure --- pkg/migrations/migrations.go | 4 ++-- pkg/scrape/vrallure.go | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/migrations/migrations.go b/pkg/migrations/migrations.go index 494282ae7..4d0f2e94c 100644 --- a/pkg/migrations/migrations.go +++ b/pkg/migrations/migrations.go @@ -1462,9 +1462,9 @@ func Migrate() { }, { // rebuild search indexes with new fields - ID: "0061-fix-vrhush-trailers", + ID: "0061-fix-vrhush-vrallure-trailers", Migrate: func(tx *gorm.DB) error { - sql := `update scenes set trailer_source = replace(trailer_source, 'deo-video source', 'web-vr-video-player source') where scraper_id = 'vrhush'` + sql := `update scenes set trailer_source = replace(trailer_source, 'deo-video source', 'web-vr-video-player source') where scraper_id in ('vrhush', 'vrallure')` return tx.Exec(sql).Error }, }, diff --git a/pkg/scrape/vrallure.go b/pkg/scrape/vrallure.go index 1d30f2c03..722b9f38f 100644 --- a/pkg/scrape/vrallure.go +++ b/pkg/scrape/vrallure.go @@ -51,9 +51,11 @@ func VRAllure(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out cha }) // Title / Cover - e.ForEach(`deo-video`, func(id int, e *colly.HTMLElement) { - sc.Title = strings.TrimSpace(e.Attr("title")) - sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("cover-image"))) + e.ForEach(`.latest-scene-title`, func(id int, e *colly.HTMLElement) { + sc.Title = strings.TrimSpace(e.Text) + }) + e.ForEach(`web-vr-video-player`, func(id int, e *colly.HTMLElement) { + sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("coverimage"))) }) // Gallery @@ -91,7 +93,7 @@ func VRAllure(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out cha // trailer details sc.TrailerType = "scrape_html" - params := models.TrailerScrape{SceneUrl: sc.HomepageURL, HtmlElement: "deo-video source", ContentPath: "src", QualityPath: "quality", ContentBaseUrl: "https:"} + params := models.TrailerScrape{SceneUrl: sc.HomepageURL, HtmlElement: "web-vr-video-player source", ContentPath: "src", QualityPath: "quality", ContentBaseUrl: "https:"} strParams, _ := json.Marshal(params) sc.TrailerSrc = string(strParams)