Just Another Video Tube SDK in Golang.
- Supported platforms
- Linux
- Darwin
- Windows
- BSD(s)
- Supported Databases
- Image processing
- Auto cropping
- Badge support
- Face detection
- Image hashing
- RESTful API
- 20+ providers
- Text translation
To install this package, you first need Go installed (version 1.19+ is required), then you can use the below Go command to install SDK.
go get -u github.com/javtube/javtube-sdk-go
# assume the following codes in example.go file
$ cat example.go
package main
import (
"fmt"
"log"
"github.com/javtube/javtube-sdk-go/engine"
)
func main() {
app := engine.Default()
results, err := app.SearchMovieAll("GVH-466", false)
if err != nil {
log.Fatal(err)
}
for _, result := range results {
fmt.Println(result.Provider, result.ID, result.Number, result.Title)
}
}
# run example.go and see output on console
$ go run example.go
You can find detailed examples in examples folder or specific implementations in cmd folder.
package main
import (
"log"
"time"
"github.com/javtube/javtube-sdk-go/database"
"github.com/javtube/javtube-sdk-go/engine"
)
func main() {
// Open database using in-memory SQLite.
db, _ := database.Open(&database.Config{
DSN: ":memory:",
PreparedStmt: false,
})
// Allocate app engine with request timeout set to one minute.
app := engine.New(db, time.Minute)
// Initiate DB tables, only required at the first time.
if err := app.AutoMigrate(true); err != nil {
log.Fatal(err)
}
}
func main() {
app := engine.Default()
// Search actor named `ひなたまりん` from Xs/List with fallback enabled.
app.SearchActor("ひなたまりん", xslist.Name, true)
// Search actor named `一ノ瀬もも` from all available providers with fallback enabled.
app.SearchActorAll("一ノ瀬もも", true)
// Get actor metadata id `5085` from Xs/List with lazy enabled.
app.GetActorInfoByProviderID(xslist.Name, "5085", true)
// Get actor metadata from given URL with lazy enabled.
app.GetActorInfoByURL("https://xslist.org/zh/model/15659.html", true)
}
func main() {
app := engine.Default()
// Search movie named `ABP-330` from JavBus with fallback enabled.
app.SearchMovie("ABP-330", javbus.Name, true)
// Search movie named `SSIS-110` from all available providers with fallback enabled.
// Option fallback will search the database for movie info if the corresponding providers
// fail to return valid metadata.
app.SearchMovieAll("SSIS-110", true)
// Get movie metadata id `1252925` from ARZON with lazy enable.
// With the lazy option set to true, it will first try to search the database and return
// the info directly if it exists. If the lazy option is set to false, it will fetch info
// from the given provider and update the database.
app.GetMovieInfoByProviderID(arzon.Name, "1252925", true)
// Get movie metadata from given URL with lazy enabled.
app.GetMovieInfoByURL("https://www.heyzo.com/moviepages/2189/index.html", true)
}
func main() {
app := engine.Default()
// Get actor primary image id `24490` from Xs/List.
app.GetActorPrimaryImage(xslist.Name, "24490")
// Get movie primary image id `hmn00268` from FANZA with aspect ratio and pos set to default.
app.GetMoviePrimaryImage(fanza.Name, "hmn00268", -1, -1)
// Get movie primary image id `hmn00268` from FANZA with aspect ratio set to 7:10 and pos
// set to the center.
app.GetMoviePrimaryImage(fanza.Name, "hmn00268", 0.70, 0.5)
// Get movie backdrop image id `DLDSS-077` from SOD.
app.GetMovieBackdropImage(sod.Name, "DLDSS-077")
}
package main
import (
"github.com/javtube/javtube-sdk-go/translate"
)
func main() {
var (
appId = "XXX"
appKey = "XXX"
)
// Translate `Hello` from auto to Japanese by Baidu.
translate.BaiduTranslate("Hello", "auto", "ja", appId, appKey)
var apiKey = "XXX"
// Translate `Hello` from auto to simplified Chinese by Google.
translate.GoogleTranslate("Hello", "auto", "zh-cn", apiKey)
}
Library | Description |
---|---|
gocolly/colly | Elegant Scraper and Crawler Framework for Golang |
gin-gonic/gin | Gin is a HTTP web framework written in Go |
gorm.io/gorm | The fantastic ORM library for Golang |
esimov/pigo | Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go |
modernc.org/sqlite | Package sqlite is a CGo-free port of SQLite/SQLite3 |
corona10/goimagehash | Go Perceptual image hashing package |
antchfx/xpath | XPath package for Golang, supports HTML, XML, JSON document query |