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 WankzVR and MilfVR scraper #265

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pkg/scrape/milfvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func MilfVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan<
}
})

siteCollector.Visit("https://www.milfvr.com/videos")
siteCollector.Visit("https://www.milfvr.com/videos?o=d")

if updateSite {
updateSiteLastUpdate(scraperID)
Expand Down
38 changes: 15 additions & 23 deletions pkg/scrape/wankzvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@ func WankzVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan
sc.SceneID = slugify.Slugify(sc.Site) + "-" + sc.SiteID

// Title
e.ForEach(`header h1`, func(id int, e *colly.HTMLElement) {
e.ForEach(`h1.detail__title`, func(id int, e *colly.HTMLElement) {
sc.Title = e.Text
})

// Date
e.ForEach(`div.date`, func(id int, e *colly.HTMLElement) {
e.ForEach(`div.detail__date_time span.detail__date`, func(id int, e *colly.HTMLElement) {
tmpDate, _ := goment.New(e.Text, "DD MMMM, YYYY")
sc.Released = tmpDate.Format("YYYY-MM-DD")
})

// Duration
e.ForEach(`div.duration`, func(id int, e *colly.HTMLElement) {
if id == 1 {
tmpDuration, err := strconv.Atoi(strings.TrimSpace(strings.Replace(e.Text, "minutes", "", -1)))
if err == nil {
sc.Duration = tmpDuration
}
e.ForEach(`div.detail__date_time span.time`, func(id int, e *colly.HTMLElement) {
tmpDuration, err := strconv.Atoi(strings.TrimSpace(strings.Replace(e.Text, "minutes", "", -1)))
if err == nil {
sc.Duration = tmpDuration
}
})

Expand All @@ -61,31 +59,24 @@ func WankzVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan
sc.Filenames = append(sc.Filenames, "wankzvr-"+base+"180_180x180_3dh_LR.mp4")

// Cover URLs
e.ForEach(`div.swiper-slide img`, func(id int, e *colly.HTMLElement) {
e.ForEach(`head meta[property="og:image"]`, func(id int, e *colly.HTMLElement) {
if id == 0 {
sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("src")))
}
})

// Gallery
e.ForEach(`div.swiper-slide img.lazyload`, func(id int, e *colly.HTMLElement) {
if id > 0 {
sc.Gallery = append(sc.Gallery, e.Request.AbsoluteURL(e.Attr("data-src")))
sc.Covers = append(sc.Covers, e.Request.AbsoluteURL(e.Attr("content")))
}
})

// Synopsis
e.ForEach(`p.description`, func(id int, e *colly.HTMLElement) {
sc.Synopsis = strings.TrimSpace(strings.Replace(e.Text, " Read more", "", -1))
e.ForEach(`div.detail__txt`, func(id int, e *colly.HTMLElement) {
sc.Synopsis = strings.TrimSpace(e.Text)
})

// Tags
e.ForEach(`div.tags a`, func(id int, e *colly.HTMLElement) {
e.ForEach(`div.tag-list__body a`, func(id int, e *colly.HTMLElement) {
sc.Tags = append(sc.Tags, e.Text)
})

// Cast
e.ForEach(`header h4 a`, func(id int, e *colly.HTMLElement) {
e.ForEach(`div.detail__header-lg div.detail__models a`, func(id int, e *colly.HTMLElement) {
sc.Cast = append(sc.Cast, strings.TrimSpace(e.Text))
})

Expand All @@ -97,17 +88,18 @@ func WankzVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out chan
siteCollector.Visit(pageURL)
})

siteCollector.OnHTML(`div.contentContainer article a`, func(e *colly.HTMLElement) {
siteCollector.OnHTML(`ul.cards-list a.video`, func(e *colly.HTMLElement) {
sceneURL := e.Request.AbsoluteURL(e.Attr("href"))
sceneURL = strings.Replace(sceneURL, "/preview", "", -1)

// If scene exist in database, there's no need to scrape
log.Infoln("found ", sceneURL)
if !funk.ContainsString(knownScenes, sceneURL) && !strings.Contains(sceneURL, "/join") {
sceneCollector.Visit(sceneURL)
}
})

siteCollector.Visit("https://www.wankzvr.com/videos")
siteCollector.Visit("https://www.wankzvr.com/videos?o=d")

if updateSite {
updateSiteLastUpdate(scraperID)
Expand Down