Bukk94 / CoubDownloader

Tool for downloading Coub videos on Windows
MIT License
25 stars 2 forks source link

urllib.error.ContentTooShortError exception #3

Closed lnarolski closed 2 years ago

lnarolski commented 2 years ago

Exception when I was trying to download all liked coubs:

file 'Coubs\liked\1gti82_250 пингвинов против одного Чака Норриса.mp4'
  1340 out of 1974 (https://coub.com/view/eg063)
file 'Coubs\liked\eg063_capoo.mp4'
  1341 out of 1974 (https://coub.com/view/1e9mbu)
file 'Coubs\liked\1e9mbu_Cat.mp4'
  1342 out of 1974 (https://coub.com/view/e3hk2)
file 'Coubs\liked\e3hk2_Let me out.mp4'
  1343 out of 1974 (https://coub.com/view/1eswff)
file 'Coubs\liked\1eswff_Die.mp4'
  1344 out of 1974 (https://coub.com/view/1c723k)
file 'Coubs\liked\1c723k_water in shower.mp4'
  1345 out of 1974 (https://coub.com/view/1b22ia)
file 'Coubs\liked\1b22ia_Die mf die!.mp4'
  1346 out of 1974 (https://coub.com/view/1bodah)
file 'Coubs\liked\1bodah_Suffer Cappo.mp4'
  1347 out of 1974 (https://coub.com/view/1e2lfk)
Traceback (most recent call last):
  File "Z:\Coub\Coub Downloader_v0.6_full\coub_v2.py", line 1012, in <module>
    main()
  File "Z:\Coub\Coub Downloader_v0.6_full\coub_v2.py", line 974, in main
    download(v_link, a_link, a_ext, name)
  File "Z:\Coub\Coub Downloader_v0.6_full\coub_v2.py", line 820, in download
    urlretrieve(a_link, name + "." + a_ext)
  File "Z:\Coub\Coub Downloader_v0.6_full\lib\urllib\request.py", line 280, in urlretrieve
    raise ContentTooShortError(
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 4423527 out of 4919434 bytes>
DONE

I didn't have any problems with bookmarked coubs. Probably you should implement some retry/resume function. Some PC info:

WindowsBuildLabEx                                       : 19041.1.amd64fre.vb_release.191206-1406
WindowsCurrentVersion                                   : 6.3
WindowsEditionId                                        : EducationN
WindowsInstallationType                                 : Client
WindowsInstallDateFromRegistry                          : 17.10.2020 13:03:59
WindowsProductId                                        : 00328-50602-88200-AA593
WindowsProductName                                      : Windows 10 Education N
WindowsSystemRoot                                       : C:\WINDOWS
WindowsVersion                                          : 2009
CsNumberOfLogicalProcessors                             : 16
CsNumberOfProcessors                                    : 1
CsProcessors                                            : {AMD Ryzen 7 2700X Eight-Core Processor         }
CsResetCapability                                       : Other
CsResetCount                                            : -1
CsResetLimit                                            : -1
CsRoles                                                 : {LM_Workstation, LM_Server, NT}
CsStatus                                                : OK
CsSupportContactDescription                             :
CsSystemFamily                                          : To be filled by O.E.M.
CsSystemSKUNumber                                       : To be filled by O.E.M.
CsSystemType                                            : x64-based PC
CsThermalState                                          : Safe
CsTotalPhysicalMemory                                   : 17128091648
CsPhyicallyInstalledMemory                              : 16777216
CsWakeUpType                                            : PowerSwitch
OsName                                                  : Microsoft Windows 10 Education N
OsType                                                  : WINNT
OsOperatingSystemSKU                                    : 122
OsVersion                                               : 10.0.19044
OsCSDVersion                                            :
OsBuildNumber                                           : 19044
OsCountryCode                                           : 48
OsCurrentTimeZone                                       : 120
OsLocaleID                                              : 0415
OsLocale                                                : pl-PL
OsUptime                                                : 6.22:54:59.9866859
OsCodeSet                                               : 1250
OsTotalVisibleMemorySize                                : 16726652
OsFreePhysicalMemory                                    : 6320932
OsTotalVirtualMemorySize                                : 27736700
OsFreeVirtualMemory                                     : 7266580
OsInUseVirtualMemory                                    : 20470120
OsTotalSwapSpaceSize                                    :
OsSizeStoredInPagingFiles                               : 11010048
OsFreeSpaceInPagingFiles                                : 10557780
OsArchitecture                                          : 64-bitowy
OsLanguage                                              : pl-PL
KeyboardLayout                                          : pl-PL
TimeZone                                                : (UTC+01:00) Sarajewo, Skopie, Warszawa, Zagrzeb

.NET:

Zestaw .NET SDK (odzwierciedlenie dowolnego pliku global.json):
 Version:   6.0.201
 Commit:    ef40e6aa06

Środowisko uruchomieniowe:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.201\

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  3.0.101 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  5.0.301 [C:\Program Files\dotnet\sdk]
  5.0.406 [C:\Program Files\dotnet\sdk]
  6.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Bukk94 commented 2 years ago

Thank you for the detailed description of the error. As you suggested, I'll be implementing retry function to try to download it again and if that fails it will just skip that coub as failed. Single coub shouldn't crash whole downloading process.

Bukk94 commented 2 years ago

I just released version 0.7. This issue should be fixed by that, give it a shot :) @lnarolski