Skip to content

rkosegi/jdownloader-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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("test@acme.tld", "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()
}