Skip to content

Commit

Permalink
Update slrstudios.go
Browse files Browse the repository at this point in the history
Fix for scene covers FOR ANTS
  • Loading branch information
vt-idiot authored May 3, 2024
1 parent 8a580a7 commit 42d1860
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions pkg/scrape/slrstudios.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package scrape
import (
"encoding/json"
"html"
"net/http"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 42d1860

Please sign in to comment.