Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 860 Bytes

README.md

File metadata and controls

42 lines (35 loc) · 860 Bytes

JDownloader client in Go

This repository hosts code for JDownloader client written in Go

Example usage

Add link and start download

package main

import (
	"github.com/rkosegi/jdownloader-go/jdownloader"
	"go.uber.org/zap"
)

func main() {
	logger, err := zap.NewDevelopment()
	if err != nil {
		panic(err)
	}
	c := jdownloader.NewClient("[email protected]", "passw0rd", logger.Sugar())
	err = c.Connect()
	if err != nil {
		panic(err)
	}
	dev, err := c.Device("my-device-name")
	if err != nil {
		panic(err)
	}
	_, err = dev.LinkGrabber().Add([]string{"http://myremoteservice/somefile.zip"},
		jdownloader.AddLinksOptionPackage("Package-Name"),
		jdownloader.AddLinksOptionAutostart(true),
		jdownloader.AddLinksOptionDestinationDir("/mnt/download"),
		)
	if err != nil {
		panic(err)
	}
	_ = c.Disconnect()
}