Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39975a2

Browse files
authored
scraper: fix SLR trans scene cover images (#1641)
* Update slrstudios.go* Incorporates the changes from#1624 as new fallback for failure to retrieve cover image using API* Fixes trans covers, they are broken at the moment for the same reason that necessitated#1624 but required a different fix* Update slrstudios.goForgot to import `net/url`, gofmt* URL decoding was unnecessary. String replacement.* Unrelated: (temporary) gitpod environment fix forachrinza/node-ipc#59
1 parenta7fe03f commit39975a2

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

‎.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ image:
22
file:.gitpod.dockerfile
33
tasks:
44
-name:Continuous Build
5-
command:yarn global add concurrently && go install github.com/cosmtrek/air@latest && cd /workspace/xbvr && go generate && go get && yarn && yarn dev
5+
command:yarnconfig set ignore-engines true && yarnglobal add concurrently && go install github.com/cosmtrek/air@latest && cd /workspace/xbvr && go generate && go get && yarn && yarn dev
66
ports:
77
-port:9999
88
onOpen:open-preview

‎pkg/scrape/slrstudios.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out
3535
commonDb,_:=models.GetCommonDB()
3636

3737
// RegEx Patterns
38-
coverRegEx:=regexp.MustCompile(`background(?:-image)?\s*?:\s*?url\s*?\(\s*?(.*?)\s*?\)`)
3938
durationRegExForSceneCard:=regexp.MustCompile(`^(?:(\d{2}):)?(\d{2}):(\d{2})$`)
4039
durationRegExForScenePage:=regexp.MustCompile(`^T(\d{0,2})H?(\d{2})M(\d{2})S$`)
4140
filenameRegEx:=regexp.MustCompile(`[:?]|( & )|( \\u0026 )`)
@@ -48,7 +47,7 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out
4847
sc.Site=siteID
4948
sc.MasterSiteId=masterSiteId
5049
ifscraperID=="" {
51-
// there maybe no site/studio if user isjusy scraping a scene url
50+
// there maybe no site/studio if user isjust scraping a scene url
5251
e.ForEach(`div[data-qa="page-scene-studio-name"]`,func(idint,e*colly.HTMLElement) {
5352
sc.Studio=strings.TrimSpace(e.Text)
5453
sc.Site=strings.TrimSpace(e.Text)
@@ -153,26 +152,28 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out
153152
iflen(coverURL)>0 {
154153
sc.Covers=append(sc.Covers,coverURL)
155154
}else {
156-
coverURL:=e.ChildAttr(`.splash-screen > img`,"src")
157-
iflen(coverURL)>0 {
158-
sc.Covers=append(sc.Covers,coverURL)
159-
}else {
160-
m:=coverRegEx.FindStringSubmatch(strings.TrimSpace(e.ChildAttr(`.c-webxr-splash-screen`,"style")))
161-
iflen(m)>0&&len(m[1])>0 {
162-
sc.Covers=append(sc.Covers,m[1])
163-
}
164-
}
155+
e.ForEach(`link[as="image"]`,func(idint,e*colly.HTMLElement) {
156+
sc.Covers=append(sc.Covers,e.Request.AbsoluteURL(e.Attr("href")))
157+
})
165158
}
166159
}else {
167-
tcoverURL:=e.ChildAttr(`.splash-screen > img`,"src")
168-
iflen(tcoverURL)>0 {
169-
sc.Covers=append(sc.Covers,tcoverURL)
170-
}else {
171-
m:=coverRegEx.FindStringSubmatch(strings.TrimSpace(e.ChildAttr(`.c-webxr-splash-screen`,"style")))
172-
iflen(m)>0&&len(m[1])>0 {
173-
sc.Covers=append(sc.Covers,m[1])
160+
posterURLFound:=false
161+
e.ForEach(`script[type="text/javascript"]`,func(idint,e*colly.HTMLElement) {
162+
ifposterURLFound {
163+
return
174164
}
175-
}
165+
scriptContent:=e.Text
166+
ifstrings.Contains(scriptContent,"posterURL") {
167+
startIndex:=strings.Index(scriptContent,`"posterURL":"`)+len(`"posterURL":"`)
168+
endIndex:=strings.Index(scriptContent[startIndex:],`"`)
169+
ifstartIndex>=0&&endIndex>=0 {
170+
posterURL:=scriptContent[startIndex :startIndex+endIndex]
171+
unescapedURL:=strings.ReplaceAll(posterURL,`\`,"")
172+
sc.Covers=append(sc.Covers,unescapedURL)
173+
posterURLFound=true
174+
}
175+
}
176+
})
176177
}
177178

178179
// straight and trans videos use a different page structure

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp