Skip to content

Commit

Permalink
Merge branch 'xbapps:master' into util
Browse files Browse the repository at this point in the history
  • Loading branch information
theRealKLH authored Oct 30, 2023
2 parents 38316c6 + d82b55e commit 56edf86
Show file tree
Hide file tree
Showing 14 changed files with 505 additions and 417 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/ProtonMail/go-appdir v1.1.0
github.com/PuerkitoBio/goquery v1.8.1
github.com/abbot/go-http-auth v0.4.0
github.com/anacrolix/ffprobe v1.0.1
github.com/anacrolix/ffprobe v1.1.0
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/avast/retry-go/v4 v4.5.0
github.com/blevesearch/bleve/v2 v2.3.10
Expand All @@ -18,7 +18,7 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/emicklei/go-restful-openapi/v2 v2.9.1
github.com/emicklei/go-restful/v3 v3.11.0
github.com/gammazero/nexus/v3 v3.2.0
github.com/gammazero/nexus/v3 v3.2.1
github.com/getlantern/systray v1.2.2
github.com/go-openapi/spec v0.20.9
github.com/go-resty/resty/v2 v2.7.0
Expand All @@ -45,7 +45,7 @@ require (
github.com/nleeper/goment v1.4.4
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/pkg/errors v0.9.1
github.com/putdotio/go-putio v1.7.0
github.com/putdotio/go-putio v1.7.1
github.com/robertkrimen/otto v0.2.1
github.com/robfig/cron/v3 v3.0.1
github.com/rs/cors v1.9.0
Expand Down Expand Up @@ -138,7 +138,7 @@ require (
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tkuchiki/go-timezone v0.2.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/abbot/go-http-auth v0.4.0/go.mod h1:Cz6ARTIzApMJDzh5bRMSUou6UMSp0IEXg
github.com/anacrolix/envpprof v1.0.0 h1:AwZ+mBP4rQ5f7JSsrsN3h7M2xDW/xSE66IPVOqlnuUc=
github.com/anacrolix/ffprobe v1.0.1 h1:S/MfCrUNZvbkkykX/1mmLVRf8//M7mvlY3BcwHaK3bQ=
github.com/anacrolix/ffprobe v1.0.1/go.mod h1:MXe+zG/RRa5OdIf5+VYYfS/CfsSqOH7RrvGIqJBzqhI=
github.com/anacrolix/ffprobe v1.1.0 h1:eKBudnERW9zRJ0+ge6FzkQ0pWLyq142+FJrwRwSRMT4=
github.com/anacrolix/ffprobe v1.1.0/go.mod h1:MXe+zG/RRa5OdIf5+VYYfS/CfsSqOH7RrvGIqJBzqhI=
github.com/anacrolix/missinggo v1.1.0 h1:0lZbaNa6zTR1bELAIzCNmRGAtkHuLDPJqTiTtXoAIx8=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
Expand Down Expand Up @@ -112,6 +114,8 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gammazero/nexus/v3 v3.2.0 h1:dKdGk4vQ/56wX5CLKUt6U3XQymUhTY6xHowBO9Z7bVA=
github.com/gammazero/nexus/v3 v3.2.0/go.mod h1:h/5Osjg08QGAk+dVFpwdGdD8VsK+IGDm5E4PzVli264=
github.com/gammazero/nexus/v3 v3.2.1 h1:9sqURks8EBEYkyEmkCtw85oApQ4ou0FCfh/jUG+Jq4I=
github.com/gammazero/nexus/v3 v3.2.1/go.mod h1:SvrRjMwDP4S9RSx52Ks39ksmYA1FQQ0OuGKcleMJTQ0=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So=
Expand Down Expand Up @@ -314,6 +318,8 @@ github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwa
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/putdotio/go-putio v1.7.0 h1:iL7G9O30NCiOH4FULbul/tRNWDA9LuvlsfXjBIBmRY4=
github.com/putdotio/go-putio v1.7.0/go.mod h1:QhjpLhn3La/ea4FeJlp1qsiaFZDC0EIO8VUe8VEKMV0=
github.com/putdotio/go-putio v1.7.1 h1:316PpOMO2a7H73foRxlpHmekeLso07et26Z00YlwQ2A=
github.com/putdotio/go-putio v1.7.1/go.mod h1:QhjpLhn3La/ea4FeJlp1qsiaFZDC0EIO8VUe8VEKMV0=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/robertkrimen/otto v0.2.1 h1:FVP0PJ0AHIjC+N4pKCG9yCDz6LHNPCwi/GKID5pGGF0=
github.com/robertkrimen/otto v0.2.1/go.mod h1:UPwtJ1Xu7JrLcZjNWN8orJaM5n5YEtqL//farB5FlRY=
Expand Down Expand Up @@ -355,6 +361,8 @@ github.com/tkuchiki/go-timezone v0.2.0/go.mod h1:b1Ean9v2UXtxSq4TZF0i/TU9NuoWa9h
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"pretty-bytes": "6.1.1",
"videojs-hotkeys": "0.2.28",
"videojs-vr": "1.8.0",
"vue": "2.7.14",
"vue": "2.7.15",
"vue-debounce": "4.0.0",
"vue-gallery": "2.0.5",
"vue-global-events": "1.2.1",
Expand All @@ -43,21 +43,21 @@
"@vue/eslint-config-standard": "8.0.1",
"buffer": "6.0.3",
"concurrently": "7.6.0",
"eslint": "8.48.0",
"eslint-plugin-import": "2.28.1",
"eslint": "8.52.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-standard": "4.1.0",
"eslint-plugin-vue": "9.17.0",
"eslint-plugin-vue": "9.18.0",
"less": "4.2.0",
"less-loader": "11.1.3",
"sass": "1.66.1",
"sass": "1.69.5",
"sass-loader": "13.3.2",
"simple-progress-webpack-plugin": "2.0.0",
"vue-cli-plugin-i18n": "2.3.2",
"vue-i18n-extract": "2.0.7",
"vue-template-compiler": "2.7.14",
"webpack": "5.88.2"
"vue-template-compiler": "2.7.15",
"webpack": "5.89.0"
},
"eslintConfig": {
"root": true,
Expand Down
6 changes: 5 additions & 1 deletion pkg/api/scenes.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type RequestEditSceneDetails struct {
Images string `json:"images"`
CoverURL string `json:"cover_url"`
IsMultipart bool `json:"is_multipart"`
Duration string `json:"duration"`
}

type ResponseGetScenes struct {
Expand Down Expand Up @@ -804,7 +805,10 @@ func (i SceneResource) editScene(req *restful.Request, resp *restful.Response) {
scene.IsMultipart = r.IsMultipart
models.AddAction(scene.SceneID, "edit", "is_multipart", strconv.FormatBool(r.IsMultipart))
}

if strconv.Itoa(scene.Duration) != r.Duration {
scene.Duration, _ = strconv.Atoi(r.Duration)
models.AddAction(scene.SceneID, "edit", "duration", r.Duration)
}
ProcessTagChanges(&scene, &r.Tags, db)

newCast := make([]models.Actor, 0)
Expand Down
110 changes: 0 additions & 110 deletions pkg/scrape/javbus.go

This file was deleted.

126 changes: 126 additions & 0 deletions pkg/scrape/r18d.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package scrape

import (
"html"
"strconv"
"strings"

"github.com/go-resty/resty/v2"
"github.com/tidwall/gjson"
"github.com/xbapps/xbvr/pkg/models"
)

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()

content_id := gjson.Get(JsonMetadata, "content_id").String()
sc.HomepageURL = "https://www.dmm.co.jp/en/digital/videoa/-/detail/=/cid=" + content_id + "/"

// Title
if gjson.Get(JsonMetadata, "title_en_is_machine_translation").String() == "false" {
sc.Title = strings.Replace(strings.TrimSpace(html.UnescapeString(gjson.Get(JsonMetadata, "title_en").String())), "[VR] ", "", -1)
} else {
sc.Title = gjson.Get(JsonMetadata, "content_id").String()
sc.Synopsis = gjson.Get(JsonMetadata, "title_en").String()
}

// Studio
sc.Studio = gjson.Get(JsonMetadata, "maker_name_en").String()

// Date
sc.Released = gjson.Get(JsonMetadata, "release_date").String()

// Time
tmpDuration, err := strconv.Atoi(gjson.Get(JsonMetadata, "runtime_mins").String())
if err == nil {
sc.Duration = tmpDuration
}

// Covers
coverimgs := gjson.Get(JsonMetadata, "jacket_full_url")
sc.Covers = append(sc.Covers, strings.TrimSpace(html.UnescapeString(coverimgs.String())))

// Gallery
galleryimgs := gjson.Get(JsonMetadata, "gallery.#.image_full")
for _, name := range galleryimgs.Array() {
sc.Gallery = append(sc.Gallery, strings.TrimSpace(html.UnescapeString(name.String())))
}

// Cast
actornames := gjson.Get(JsonMetadata, "actresses.#.name_romaji")
for _, name := range actornames.Array() {
sc.Cast = append(sc.Cast, strings.TrimSpace(html.UnescapeString(name.String())))
}

// Tags
// Skipping some very generic and useless tags
skiptags := map[string]bool{
"Featured Actress": true,
"VR Exclusive": true,
"High-Quality VR": true,
"Exclusive Distribution": true,
}

// JSON dump from R18's final days shows "女子校生" replaced with "Academy Uniform" instead of "Schoolgirl" - r18.dev seems to follow the same mapping for FANZA category 1018 - get your credit card compliance puritanism out of my porn, I don't need "Academy Uniform" and "Uniform" tagged together lmao
joshikosei := "Academy Uniform"

taglist := gjson.Get(JsonMetadata, "categories.#.name_en")
quality := "VR"
has8KVR := false
for _, name := range taglist.Array() {
if name.Str == "8KVR" {
has8KVR = true
quality = "8K"
} else if name.Str == "High-Quality VR" && !has8KVR {
quality = "HQ"
}
if !skiptags[name.Str] {
if name.Str == joshikosei {
sc.Tags = append(sc.Tags, "schoolgirl")
} else {
sc.Tags = append(sc.Tags, strings.TrimSpace(html.UnescapeString(name.String())))
}
}
}
sc.Tags = append(sc.Tags, "JAVR")
sc.Tags = append(sc.Tags, "R18.dev")

// Scene ID and Site
dvdID := gjson.Get(JsonMetadata, "dvd_id").String()
if dvdID == "----" || dvdID == "" {
sc.SceneID = content_id
sc.SiteID = content_id
sc.Site = gjson.Get(JsonMetadata, "label_name_en").String()
} else {
sc.SceneID = dvdID
sc.SiteID = dvdID
sc.Site = strings.Split(dvdID, "-")[0]
}

// Filler Filenames
resolutions := []string{"vmb"}
if quality == "HQ" {
resolutions = []string{"vrv1uhqe"}
} else if quality == "8K" {
resolutions = []string{"vrv1uhqf", "vrv18khia"}
}
for r := range resolutions {
parts := []string{"", "1", "2", "3"}
for p := range parts {
fn := content_id + resolutions[r] + parts[p] + ".mp4"
sc.Filenames = append(sc.Filenames, fn)
}
}

if sc.SceneID != "" {
*out = append(*out, sc)
}
}
return nil
}
Loading

0 comments on commit 56edf86

Please sign in to comment.