fix nil ptr?

This commit is contained in:
Niko Storni 2022-08-16 02:41:14 +02:00
parent ea3315d1d6
commit 9ef1b7800b
3 changed files with 8 additions and 8 deletions

View file

@ -285,7 +285,8 @@ func runCmd(cmd *exec.Cmd, stopChan stop.Chan) ([]string, error) {
return nil, errors.Err("interrupted by user") return nil, errors.Err("interrupted by user")
case err := <-done: case err := <-done:
if err != nil { if err != nil {
return nil, errors.Prefix("yt-dlp "+strings.Join(cmd.Args, " ")+" ["+string(errorLog)+"]", err) //return nil, errors.Prefix("yt-dlp "+strings.Join(cmd.Args, " ")+" ["+string(errorLog)+"]", err)
return nil, errors.Prefix(string(errorLog), err)
} }
return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil
} }

View file

@ -26,13 +26,10 @@ func TestGetVideoInformation(t *testing.T) {
s := stop.New() s := stop.New()
ip, err := ip_manager.GetIPPool(s) ip, err := ip_manager.GetIPPool(s)
assert.NoError(t, err) assert.NoError(t, err)
video, err := GetVideoInformation("zT_c6YhkXow", s.Ch(), ip) video, err := GetVideoInformation("kDGOHNpRjzc", s.Ch(), ip)
if err != nil { assert.NoError(t, err)
logrus.Error(err) assert.NotNil(t, video)
} logrus.Info(video.ID)
if video != nil {
logrus.Info(video.ID)
}
} }
func Test_getUploadTime(t *testing.T) { func Test_getUploadTime(t *testing.T) {

View file

@ -78,6 +78,7 @@ var ErrorsNoRetry = []string{
"giving up after 0 fragment retries", "giving up after 0 fragment retries",
"Sorry about that", "Sorry about that",
"This video is not available", "This video is not available",
"Video unavailable",
"requested format not available", "requested format not available",
"interrupted by user", "interrupted by user",
"Sign in to confirm your age", "Sign in to confirm your age",
@ -117,6 +118,7 @@ var NeverRetryFailures = []string{
"Playback on other websites has been disabled by the video owner", "Playback on other websites has been disabled by the video owner",
"uploader has not made this video available in your country", "uploader has not made this video available in your country",
"This video has been removed by the uploader", "This video has been removed by the uploader",
"Video unavailable",
} }
type SyncFlags struct { type SyncFlags struct {