From c96be18a2b3832651d1a975f862619569c9c3d52 Mon Sep 17 00:00:00 2001 From: toshski Date: Wed, 4 Sep 2024 08:26:37 +1200 Subject: [PATCH] Changed Scene Id logic. --- pkg/scrape/vrspy.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pkg/scrape/vrspy.go b/pkg/scrape/vrspy.go index 22ab5a183..da94c8502 100755 --- a/pkg/scrape/vrspy.go +++ b/pkg/scrape/vrspy.go @@ -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 }