jaysonlong / webvideo-downloader

Web video downloader for Bilibili, iQIYI, Tencent Video, MGTV and WeTV. 网站视频下载器,主要支持Bilibili、爱奇艺、腾讯视频、芒果TV、WeTV、愛奇藝台灣站。
1.12k stars 244 forks source link

KeyError: 'content-length' #167

Open khanguyenwk opened 1 year ago

khanguyenwk commented 1 year ago

Hello Jaysonlong Thank you so much for your awesome program, I really love it. But recently I get an error when downloading video from iq.com

Can you help to check? Thank you a lot


Traceback (most recent call last): File "E:\Work\Code\webvideo\downloader\dispatcher.py", line 167, in dispatch self.download(url, fileName, data) File "E:\Work\Code\webvideo\downloader\dispatcher.py", line 139, in download targetFileName = self.handleSubtitles(subtitles, fileName, targetFileName, headers) File "E:\Work\Code\webvideo\downloader\dispatcher.py", line 108, in handleSubtitles self.downloader.downloadAll(subtitleUrls, subtitleNames, headers, self.hlsThreadCnt) File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 174, in downloadAll self._waitUtilFinish() File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 105, in _waitUtilFinish raise self.threadPool.exception File "C:\Users\Windows10\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 130, in _downloadRange raise self.threadPool.exception File "C:\Users\Windows10\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(*self.args, *self.kwargs) File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 130, in _downloadRange raise self.threadPool.exception File "C:\Users\Windows10\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(self.args, self.kwargs) File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 130, in _downloadRange raise self.threadPool.exception File "C:\Users\Windows10\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "E:\Work\Code\webvideo\downloader\tools\downloader.py", line 123, in _downloadRange rangeSize = rangeSize or int(response.headers['Content-Length']) File "C:\Users\Windows10\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\structures.py", line 54, in getitem return self._store[key.lower()][1] KeyError: 'content-length'

a735076092 commented 1 year ago

同问,批量下载b站出错:ValueError:invalid literal for int() with bast

fremzuck commented 1 year ago

I have the same problem.

ChunlyShen commented 7 months ago

Error messgae: 2024-04-07 14 06 43

Solution:

  1. go to the path: "webvideo-downloader-master\downloader\tools", and open the "downloader.py" file
  2. find "rangeSize = rangeSize or int(response.headers['Content-Length'])", and change to: try: rangeSize = rangeSize or int(response.headers['Content-Length']) except KeyError: rangeSize = len(response.content) 2024-04-07 14 21 48