Git Product home page Git Product logo

aria2-rpc's People

Contributors

kahosan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

saeidrp

aria2-rpc's Issues

Remove 返回: [-32603] unexpected HTTP status 400 Bad Request

环境 windows
go version go1.19 windows/amd64
版本 : github.com/kahosan/aria2-rpc v0.1.1


package main

import (
	"fmt"
	ario "github.com/kahosan/aria2-rpc"
	"os/exec"
	"time"
)

func main() {
	cmd := exec.Command("sdk/aria2/aria2c.exe", "--conf-path=sdk/aria2/aria2.conf", fmt.Sprintf("--rpc-listen-port=%d", 10001))
	if err := cmd.Start(); err != nil {
		fmt.Println(fmt.Sprintf("Failed to start aria2: %v", err))
		return
	}

	time.Sleep(time.Second)

	Aria2, err := ario.NewClient(fmt.Sprintf("http://localhost:%d/jsonrpc", 10001), "", false)
	if err != nil {
		fmt.Println(fmt.Sprintf("Failed to create aria2 client: %v", err))
		return
	}


	gid, err := Aria2.AddURI([]string{"https://cn-xj-ct-01-01.bilivideo.com/upgcxcode/20/53/1386065320/1386065320-1-30121.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1717489512&gen=playurlv2&os=bcache&oi=3060077860&trid=00008934c27bb2674992a9020bb950b4d7c6u&mid=19121461&platform=pc&og=cos&upsig=4b94248990f2ea612fafdab168ca9589&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&cdnid=87001&bvc=vod&nettype=0&orderid=0,3&buvid=0B3A4BAC-8B9F-1142-FB85-F46BDEB500C894632infoc&build=0&f=u_0_0&agrr=1&bw=644989&logo=80000000"}, nil) //这个url肯定会报错的
	if err != nil {
		fmt.Println(fmt.Sprintf("Failed to add download: %v", err))
		return
	}

	fmt.Println("get gid : ", gid)

	//延时一会儿模拟其他操作
	time.Sleep(5 * time.Second)

	err = Aria2.Remove(gid)
	if err != nil {

		_, err2 := Aria2.TellStatus(gid)
		if err2 != nil {
			fmt.Println(fmt.Sprintf("Failed to get download status in remove: %v", err))
		}

		fmt.Println(fmt.Sprintf("Failed to remove download: %v", err))
		return
	}

	download, err := Aria2.TellStatus(gid)
	if err != nil {
		fmt.Println(fmt.Sprintf("Failed to get download status: %v", err))
	}

	fmt.Println("status : ", download.Status)

}

输出 :

get gid :  52bd231f9da61474
Failed to get download status in remove: [-32603] unexpected HTTP status 400 Bad Request
Failed to remove download: [-32603] unexpected HTTP status 400 Bad Request

如果不加中间暂停5s 可以正常删除, 是我的操作问题吗?
是否下载异常的不用删除?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.