From 42d186080f439deda9eeeaf0d28b54f57a7acd43 Mon Sep 17 00:00:00 2001 From: vt-idiot <81622808+vt-idiot@users.noreply.github.com> Date: Fri, 3 May 2024 14:11:18 -0400 Subject: [PATCH 1/3] Update slrstudios.go Fix for scene covers FOR ANTS --- pkg/scrape/slrstudios.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/scrape/slrstudios.go b/pkg/scrape/slrstudios.go index cefe64dd0..755940aff 100644 --- a/pkg/scrape/slrstudios.go +++ b/pkg/scrape/slrstudios.go @@ -3,6 +3,7 @@ package scrape import ( "encoding/json" "html" + "net/http" "regexp" "strconv" "strings" @@ -148,14 +149,25 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out // Cover if !isTransScene { - coverURL := strings.Replace(gjson.Get(JsonMetadataA, "thumbnailUrl").String(), "app", "desktop", -1) - if len(coverURL) > 0 { + appCover := gjson.Get(JsonMetadataA, "thumbnailUrl").String() + desktopCover := strings.Replace(gjson.Get(JsonMetadataA, "thumbnailUrl").String(), "app", "desktop", -1) + desktopCresp, desktopCerr := http.Head(desktopCover) + if desktopCresp.StatusCode == 200 { + coverURL := desktopCover sc.Covers = append(sc.Covers, coverURL) } else { - e.ForEach(`link[as="image"]`, func(id int, e *colly.HTMLElement) { - sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("href"))) - }) - } + appCresp, appCerr := http.Head(appCover) + if appCresp.StatusCode == 200 { + coverURL := appCover + sc.Covers = append(sc.Covers, coverURL) + defer appResp.Body.Close() + } else { + e.ForEach(`link[as="image"]`, func(id int, e *colly.HTMLElement) { + sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("href"))) + }) + } + } + defer desktopResp.Body.Close() } else { posterURLFound := false e.ForEach(`script[type="text/javascript"]`, func(id int, e *colly.HTMLElement) { From bfaaed0f5e1bfebfcf6f5595bf43d14f8c721d4b Mon Sep 17 00:00:00 2001 From: vt-idiot Date: Fri, 3 May 2024 18:21:16 +0000 Subject: [PATCH 2/3] Typo, UnusedVar --- pkg/scrape/slrstudios.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/scrape/slrstudios.go b/pkg/scrape/slrstudios.go index 755940aff..6cd16b679 100644 --- a/pkg/scrape/slrstudios.go +++ b/pkg/scrape/slrstudios.go @@ -151,23 +151,23 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out if !isTransScene { appCover := gjson.Get(JsonMetadataA, "thumbnailUrl").String() desktopCover := strings.Replace(gjson.Get(JsonMetadataA, "thumbnailUrl").String(), "app", "desktop", -1) - desktopCresp, desktopCerr := http.Head(desktopCover) + desktopCresp, _ := http.Head(desktopCover) if desktopCresp.StatusCode == 200 { coverURL := desktopCover sc.Covers = append(sc.Covers, coverURL) } else { - appCresp, appCerr := http.Head(appCover) + appCresp, _ := http.Head(appCover) if appCresp.StatusCode == 200 { coverURL := appCover sc.Covers = append(sc.Covers, coverURL) - defer appResp.Body.Close() + defer appCresp.Body.Close() } else { e.ForEach(`link[as="image"]`, func(id int, e *colly.HTMLElement) { sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("href"))) }) } } - defer desktopResp.Body.Close() + defer desktopCresp.Body.Close() } else { posterURLFound := false e.ForEach(`script[type="text/javascript"]`, func(id int, e *colly.HTMLElement) { From ed3c2a9762e2c02915677dcbcf7292cfbe3705e4 Mon Sep 17 00:00:00 2001 From: vt-idiot <81622808+vt-idiot@users.noreply.github.com> Date: Fri, 3 May 2024 14:28:17 -0400 Subject: [PATCH 3/3] Update slrstudios.go gofmt... --- pkg/scrape/slrstudios.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/scrape/slrstudios.go b/pkg/scrape/slrstudios.go index 6cd16b679..17ae67331 100644 --- a/pkg/scrape/slrstudios.go +++ b/pkg/scrape/slrstudios.go @@ -161,12 +161,12 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out coverURL := appCover sc.Covers = append(sc.Covers, coverURL) defer appCresp.Body.Close() - } else { + } else { e.ForEach(`link[as="image"]`, func(id int, e *colly.HTMLElement) { sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("href"))) - }) - } + }) } + } defer desktopCresp.Body.Close() } else { posterURLFound := false