Skip to content

Commit

Permalink
fix #621
Browse files Browse the repository at this point in the history
  • Loading branch information
ma6254 committed Mar 5, 2020
1 parent 27a9baa commit 5b0ec93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 0 additions & 5 deletions downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ func mergeMultiPart(filepath string, parts []*FilePartMeta) error {
// Download download urls
func Download(v Data, refer string, chunkSizeMB int) error {
v.genSortedStreams()
if config.ExtractedData {
jsonData, _ := json.MarshalIndent(v, "", " ")
fmt.Printf("%s\n", jsonData)
return nil
}
var (
title string
stream string
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -175,6 +176,17 @@ func download(videoURL string) bool {
return false
}
var isErr bool

if config.ExtractedData {
jsonData, err := json.MarshalIndent(data, "", "\t")
if err != nil {
fmt.Printf("%s", err)
return isErr
}
fmt.Printf("%s\n", jsonData)
return !isErr
}

for _, item := range data {
if item.Err != nil {
// if this error occurs, the preparation step is normal, but the data extraction is wrong.
Expand Down

0 comments on commit 5b0ec93

Please sign in to comment.