Skip to content

Commit c398dd2

Browse files
authored
fix - throttle (#82)
1 parent 74aec6a commit c398dd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/youtube.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func DownloadVideo(url string) {
223223
if end > fileLength {
224224
end = fileLength
225225
}
226-
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", start, end))
226+
req.URL.RawQuery = req.URL.Query().Encode() + "&range=" + strconv.Itoa(start) + "-" + strconv.Itoa(end)
227227
resp, err := client.Do(req)
228228
if err != nil {
229229
printErrorProps := S.PrintErrorProps{
@@ -245,7 +245,7 @@ func DownloadVideo(url string) {
245245
bar.Set(fileLength)
246246
bar.Finish()
247247
} else {
248-
req.Header.Set("Range", fmt.Sprintf("Bytes=0-%d", fileLength))
248+
req.URL.RawQuery = req.URL.Query().Encode() + "&range=" + strconv.Itoa(0) + "-" + strconv.Itoa(fileLength)
249249
resp, err = client.Do(req)
250250
if err != nil {
251251
printErrorProps := S.PrintErrorProps{

0 commit comments

Comments
 (0)