Skip to content

Commit

Permalink
scraper: Fix duplicate actors on RealJamVR & PornCornVR (xbapps#1596)
Browse files Browse the repository at this point in the history
* Update realjamvr.go

Fixed: Actors duped in newest 4 scenes due to tagging in Synopsis.

* Update migrations.go

added migration

* Update migrations.go

updated to handle existing PorncornVR scenes (up to 01/11/2024)
  • Loading branch information
theRealKLH authored Jan 24, 2024
1 parent 861bae5 commit b3fbe1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,31 @@ func Migrate() {
return tx.Exec(sql).Error
},
},
{
ID: "0073-reset-RealJamVR-scenes-with-duped-actors",
Migrate: func(tx *gorm.DB) error {

rjn := [...]string{"realjam-vr-39859", "realjam-vr-39861", "realjam-vr-40044", "realjam-vr-40064", "porncorn-vr-39827", "porncorn-vr-39902", "porncorn-vr-40031", "porncorn-vr-39903"}
var scenes []models.Scene
err := tx.Where("studio = ?", "Real Jam Network").Find(&scenes).Error
if err != nil {
return err
}
for _, scene := range scenes {
for _, v := range rjn {
if scene.SceneID == v {
scene.NeedsUpdate = true
err = tx.Save(&scene).Error
if err != nil {
return err
}
// common.Log.Infof("Updated scene %s", scene.SceneID)
}
}
}
return nil
},
},
})

if err := m.Migrate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/scrape/realjamvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func RealJamSite(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out

// Cast
sc.ActorDetails = make(map[string]models.ActorDetails)
e.ForEach(`div.scene-view a[href^='/actor/']`, func(id int, e *colly.HTMLElement) {
e.ForEach(`div.scene-view > a[href^='/actor/']`, func(id int, e *colly.HTMLElement) {
sc.Cast = append(sc.Cast, strings.TrimSpace(e.Text))
sc.ActorDetails[strings.TrimSpace(e.Text)] = models.ActorDetails{Source: sc.ScraperID + " scrape", ProfileUrl: e.Request.AbsoluteURL(e.Attr("href"))}
})
Expand Down

0 comments on commit b3fbe1b

Please sign in to comment.