Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for missing cover 403 on low resolution SLR covers #15

Merged
merged 3 commits into from
May 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 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, _ := 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, _ := http.Head(appCover)
if appCresp.StatusCode == 200 {
coverURL := appCover
sc.Covers = append(sc.Covers, coverURL)
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 desktopCresp.Body.Close()
} else {
posterURLFound := false
e.ForEach(`script[type="text/javascript"]`, func(id int, e *colly.HTMLElement) {
Expand Down