Update v8go

master
Stein Ivar Berghei 2024-05-09 00:19:15 +02:00
parent e852c2ed83
commit 7cb34b7a45
3 changed files with 5 additions and 9 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/PuerkitoBio/goquery v1.6.1
github.com/headzoo/surf v1.0.0
github.com/mmcdole/gofeed v1.1.0
rogchap.com/v8go v0.5.1
rogchap.com/v8go v0.9.0
)
require (

2
go.sum
View File

@ -45,3 +45,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rogchap.com/v8go v0.5.1 h1:yx7uQC2ezAHthCHLHl4NuH3eprVLBtNl6Utm/ELjZ+w=
rogchap.com/v8go v0.5.1/go.mod h1:IitZnaOtWSJadY/7qinKHIEHpxsilMWyLQ+Efdo4n4I=
rogchap.com/v8go v0.9.0 h1:wYbUCO4h6fjTamziHrzyrPnpFNuzPpjZY+nfmZjNaew=
rogchap.com/v8go v0.9.0/go.mod h1:MxgP3pL2MW4dpme/72QRs8sgNMmM0pRc8DPhcuLWPAs=

View File

@ -61,10 +61,7 @@ func (app *App) GetFeed(uri string) (feed *rss.Feed, err error) {
}
func (app *App) GetChapterImages(uri string) (pages []string, err error) {
vm, err := v8go.NewContext(app.vm)
if err != nil {
return
}
vm := v8go.NewContext(app.vm)
defer vm.Close()
err = app.browser.Open(uri)
@ -140,10 +137,7 @@ func New() (app *App, err error) {
app.js = append(app.js, fq)
app.http = &http.Client{}
app.vm, err = v8go.NewIsolate()
if err != nil {
panic(err)
}
app.vm = v8go.NewIsolate()
app.browser = surf.NewBrowser()
app.fp = rss.Parser{}