Skip to content

Commit 588e5bc

Browse files
authored
fix (#85)
1 parent 6102ec7 commit 588e5bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

utils/youtube.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var key = "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w"
2323
var Filename = os.TempDir() + "tmp-video."
2424
var fileLength = 0
2525
var percent = 0
26-
var chunkSize = 8000000
26+
var chunkSize = 200000000
2727

2828
func YoutubeDownload(id string) string {
2929
var body S.YoutubeBodyMetaInfo
@@ -217,7 +217,7 @@ func DownloadVideo(url string) {
217217
if end > fileLength {
218218
end = fileLength
219219
}
220-
req.URL.RawQuery = req.URL.Query().Encode() + "&range=" + strconv.Itoa(start) + "-" + strconv.Itoa(end)
220+
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", start, end))
221221
resp, err := client.Do(req)
222222
if err != nil {
223223
printErrorProps := S.PrintErrorProps{
@@ -239,7 +239,7 @@ func DownloadVideo(url string) {
239239
bar.Set(fileLength)
240240
bar.Finish()
241241
} else {
242-
req.URL.RawQuery = req.URL.Query().Encode() + "&range=" + strconv.Itoa(0) + "-" + strconv.Itoa(fileLength)
242+
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", 0, fileLength))
243243
resp, err = client.Do(req)
244244
if err != nil {
245245
printErrorProps := S.PrintErrorProps{

0 commit comments

Comments
 (0)