Skip to content

Commit

Permalink
scraper: Added DVD-ID support for the R18dev scraper (xbapps#1566)
Browse files Browse the repository at this point in the history
* Added support for DVD-ID for the R18dev scraper.

* Removed unused code

* Restored old split logic to be able to process multiple scenes at once

* Created getByDVDId method

* Added message about the R18.dev scraper again.
  • Loading branch information
pl33x authored Jan 15, 2024
1 parent bebb3be commit 4955526
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions pkg/scrape/r18d.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@ import (

func ScrapeR18D(out *[]models.ScrapedScene, queryString string) error {
scenes := strings.Split(queryString, ",")

for _, v := range scenes {
sc := models.ScrapedScene{}
sc.SceneType = "VR"

r, _ := resty.New().R().Get("https://r18.dev/videos/vod/movies/detail/-/combined=" + v + "/json")
JsonMetadata := r.String()
req := resty.New().R()
res := getByContentId(req, v)

if res.StatusCode() == 404 {
res = getByDVDId(req, v)

if res.StatusCode() == 200 {
content_id := gjson.Get(res.String(), "content_id").String()
res = getByContentId(req, content_id)
} else {
return nil
}
}

JsonMetadata := res.String()

content_id := gjson.Get(JsonMetadata, "content_id").String()
sc.HomepageURL = "https://www.dmm.co.jp/en/digital/videoa/-/detail/=/cid=" + content_id + "/"
Expand Down Expand Up @@ -124,3 +138,15 @@ func ScrapeR18D(out *[]models.ScrapedScene, queryString string) error {
}
return nil
}

func getByContentId(req *resty.Request, content_id string) *resty.Response {
res, _ := req.Get("https://r18.dev/videos/vod/movies/detail/-/combined=" + content_id + "/json")

return res
}

func getByDVDId(req *resty.Request, dvd_id string) *resty.Response {
res, _ := req.Get("https://r18.dev/videos/vod/movies/detail/-/dvd_id=" + dvd_id + "/json")

return res
}
2 changes: 1 addition & 1 deletion ui/src/views/options/sections/OptionsSceneCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<b-input v-model="javrQuery" placeholder="ID (xxxx-001)" type="search"></b-input>
<b-button class="button is-primary" v-on:click="scrapeJAVR()">{{$t('Go')}}</b-button>
</b-field>
<span>R18.dev scraper requires FANZA content ID, e.g. 84vrkm00139</span>
<span>R18.dev scraper works best with FANZA content ID, e.g. 84vrkm00139, but DVD-ID works too when maintained.</span>
</div>
</div>

Expand Down

0 comments on commit 4955526

Please sign in to comment.