Skip to content

Commit

Permalink
Merge remote-tracking branch 'toshski/VRSPy_Scene_Id_Fix_2' into RFTW
Browse files Browse the repository at this point in the history
  • Loading branch information
theRealKLH committed Sep 8, 2024
2 parents 1cabbef + c96be18 commit 5026b63
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pkg/scrape/vrspy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ func VRSpy(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan<-
sc.Site = siteID
sc.HomepageURL = e.Request.URL.String()

ogimage := e.ChildAttr(`meta[property="og:image"][content*="cover.jpg"]`, "content")
if ogimage != "" {
ogimageURL, err := url.Parse(ogimage)
if err == nil {
parts := strings.Split(ogimageURL.Path, "/")
if len(parts) > 2 {
sc.SiteID = parts[2]
e.ForEach(`meta[property="og:image"][content*="vrspy.com/videos"]`, func(id int, e *colly.HTMLElement) {
if sc.SiteID == "" {
ogimage := e.Attr("content")
if ogimage != "" {
ogimageURL, err := url.Parse(ogimage)
if err == nil {
parts := strings.Split(ogimageURL.Path, "/")
if len(parts) > 2 {
_, err := strconv.Atoi(parts[2])
if err == nil {
sc.SiteID = parts[2]
}
}
}
}
}
}
})

if sc.SiteID == "" {
log.Infof("Unable to determine a Scene Id for %s", e.Request.URL)
return
}

Expand Down

0 comments on commit 5026b63

Please sign in to comment.