Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0746b1a

Browse files
gaardercrwxaj
andauthored
scraper: Update javdatabase scraper
* Update javdatabase.go to fix scraping - correction* go fmt---------Co-authored-by: crwxaj <52156245+crwxaj@users.noreply.github.com>
1 parent796a50b commit0746b1a

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

‎pkg/scrape/javdatabase.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,66 @@ func ScrapeJavDB(out *[]models.ScrapedScene, queryString string) {
9494

9595
})
9696

97+
html.ForEach(`p.mb-1`,func(idint,p*colly.HTMLElement) {
98+
tr:=strings.Split(p.Text,": ")
99+
label:=tr[0]
100+
101+
iflabel==`Studio` {
102+
// Studio
103+
sc.Studio=tr[1]
104+
105+
}elseiflabel==`DVD ID` {
106+
// Title, SceneID and SiteID all like 'VRKM-821' format
107+
dvdId:=strings.ToUpper(tr[1])
108+
sc.Title=dvdId
109+
sc.SceneID=dvdId
110+
sc.SiteID=dvdId
111+
112+
// Set 'Site' to first part of the ID (e.g. `VRKM for `vrkm-821`)
113+
siteParts:=strings.Split(dvdId,`-`)
114+
iflen(siteParts)>0 {
115+
sc.Site=siteParts[0]
116+
}
117+
118+
}elseiflabel==`Release Date` {
119+
// Release date
120+
dateStr:=tr[1]
121+
tmpDate,_:=goment.New(strings.TrimSpace(dateStr),"YYYY-MM-DD")
122+
sc.Released=tmpDate.Format("YYYY-MM-DD")
123+
124+
}elseiflabel==`Genre(s)` {
125+
// Tags
126+
/* NOTE:
127+
"Tags are technically incomplete vs. what you'd get translating dmm.co.jp
128+
tags/correlating them back to their old equivalents on r18 using something
129+
like Javinizer's tag CSV"
130+
*/
131+
p.ForEach("a",func(idint,anchor*colly.HTMLElement) {
132+
href:=anchor.Attr("href")
133+
ifstrings.Contains(href,"javdatabase.com/genres/") {
134+
// Tags
135+
tag:=ProcessJavrTag(anchor.Text)
136+
137+
iftag!="" {
138+
sc.Tags=append(sc.Tags,tag)
139+
}
140+
}
141+
})
142+
143+
}elseiflabel==`Translated Title` {
144+
// Synopsis / description
145+
sc.Synopsis=tr[1]
146+
147+
}elseiflabel==`Content ID` {
148+
contentId=tr[1]
149+
150+
}elseiflabel=="Runtime" {
151+
// Duration
152+
sc.Duration,_=strconv.Atoi(strings.Split(tr[1]," ")[0])
153+
}
154+
155+
})
156+
97157
// Screenshots
98158
html.ForEach("a[href]",func(_int,anchor*colly.HTMLElement) {
99159
linkHref:=anchor.Attr(`href`)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp