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

Commit7ca0840

Browse files
authored
scraper: SinsVR cast fix (#1823)
* SinsVR Fix for model not present on scrapeOccasionally sinsVR will leave out the model on the scene page resulting in no model being listed for the scene. This falls back to using the trailer URL which contains the models in the scenes* Debug prompt removal* Some more tweaks. Check to ensure the profile url is valid. Notice occasionally there is a misspelling of the actor name in the url* Format
1 parent402436b commit7ca0840

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎pkg/scrape/sinsvr.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package scrape
22

33
import (
44
"encoding/json"
5+
"net/http"
56
"regexp"
67
"strconv"
78
"strings"
@@ -66,15 +67,18 @@ func SinsVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan<
6667
sc.ActorDetails=make(map[string]models.ActorDetails)
6768
e.ForEach(`.video-detail__specs div.cell`,func(idint,e*colly.HTMLElement) {
6869
c:=strings.TrimSpace(e.Text)
70+
6971
// Cast
7072
ifstrings.Contains(c,"Starring") {
7173
e.ForEach(`.cell a`,func(idint,e*colly.HTMLElement) {
74+
7275
cast:=strings.Split(e.Text,",")
7376
sc.Cast=append(sc.Cast,cast...)
7477
iflen(cast)>1 {
7578
sc.ActorDetails[strings.TrimSpace(e.Text)]= models.ActorDetails{Source:sc.ScraperID+" scrape",ProfileUrl:e.Request.AbsoluteURL(e.Attr("href"))}
7679
}
7780
sc.ActorDetails[strings.TrimSpace(e.Text)]= models.ActorDetails{Source:sc.ScraperID+" scrape",ProfileUrl:e.Request.AbsoluteURL(e.Attr("href"))}
81+
7882
})
7983
}else {
8084
// Released - Date Oct 19, 2019
@@ -85,6 +89,30 @@ func SinsVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan<
8589
}
8690
})
8791

92+
// Fallback incase SinsVR forgets to add the actor to the scene. This uses the trailer URL which contains the models in the scene.
93+
iflen(sc.Cast)==0 {
94+
trailerURL:=e.ChildAttr("div.video-player-container__player source","src")
95+
//The cast is the first part of the trailer file name in the URL
96+
re:=regexp.MustCompile(`https:\/\/public\.xsinsvr\.com\/video\/.+\/(?P<cast>[A-Za-z_-]+)_trailer`)
97+
r:=re.FindStringSubmatch(trailerURL)
98+
castIndex:=re.SubexpIndex("cast")
99+
//sinsVR uses _ for whitespace and - to separate cast members
100+
cast:=strings.Split(strings.ReplaceAll(r[castIndex],"_"," "),"-")
101+
sc.Cast=append(sc.Cast,cast...)
102+
103+
// This should result in the correct model url for sinsVR but occasionally sins has yet to create the model url and will result in a 404
104+
for_,name:=rangecast {
105+
profileUrl:=`https://xsinsvr.com/model/`+strings.ToLower(strings.ReplaceAll(name," ","-"))
106+
profileUrlResp,err:=http.Head(profileUrl)
107+
iferr!=nil {
108+
log.Errorf("Method Head Failed on profileUrlResp %s with error %s",profileUrlResp,err)
109+
}elseifprofileUrlResp.StatusCode==200 {//The url is not valid don't bother adding it to the ActorDetails
110+
sc.ActorDetails[name]= models.ActorDetails{Source:sc.ScraperID+" scrape",ProfileUrl:profileUrl}
111+
}
112+
deferprofileUrlResp.Body.Close()
113+
}
114+
}
115+
88116
// Duration
89117
durationText:=e.ChildText(`div.video-player-container__info div.tn-video-props span`)
90118
for_,regex:=rangedurationRegexes {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp