Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] network down error, exit-code is still 0 ("success") #15546

Closed
eladkarako opened this issue Feb 9, 2018 · 3 comments
Closed

[Windows] network down error, exit-code is still 0 ("success") #15546

eladkarako opened this issue Feb 9, 2018 · 3 comments

Comments

@eladkarako
Copy link

@eladkarako eladkarako commented Feb 9, 2018

I've noticed that Windows error codes (ERRORLEVEL) although useful does not work great in YouTube-dl,
is there any chance of fixing it?

Specifically issues occur on YouTube-dl's early stages,
if the network is done for some reason during the "Downloading webpage",
you always get something like:

[youtube] Fy8l1POkotM: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it> (caused by URLError(ConnectionRefusedError(10061, 'No connection could be made because the target machine actively refused it', None, 10061, None),))
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\extractor\common.py", line 517, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\YoutubeDL.py", line 2198, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 464, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 482, in _open
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\utils.py", line 933, in http_open
  File "C:\Python\Python34\lib\urllib\request.py", line 1185, in do_open

I've mocked the "network down" using a system-wide proxy (Fiddler), which on-close, kills the socket.

at the bottom of the batch file, right after the YouTube-dl call, I've included echo ERRORLEVEL ==== %ERRORLEVEL%, and indeed it was 0.

a 1.30MB animated gif, please wait...


the funny thing is that on my machine,
there is no user named dst, so C:\Users\dst\ does not make much sense,
I've would expect C:\Users\Elad (or C:\Users\All Users`),
could it be possible a hard-coded thing?


I don't mind so much the actual error, or how gracefully it is handled,
just hoping for a clear exit-code, also, I guess I've RTFM.


Here is the complete output,
but you can ignore it - it will replicate each time if you kill the socket (using any method you'll like)


C:\Users\Elad\Desktop>ytdl list1.txt


C:\Users\Elad\Desktop>call "D:\DOS\YOUTUB~1\ytdl2list.cmd" "list1.txt"
 Downloading Links From "list1.txt"...
https://www.youtube.com/watch?v=Fy8l1POkotM&disable_polymer=1

call D:\DOS\YOUTUB~1\YOUTUB~1.EXE  --external-downloader aria2c --external-downloader-args "--file-allocation=prealloc --human-readable=true --enable-color=true --split=3 --save-session-interval=10 --auto-save-interval=10 --retry-wait=3 --max-tries=10 --timeout=120 --connect-timeout=300 --max-file-not-found=3 --continue=true --allow-overwrite=false --auto-file-renaming=false --check-integrity=false --enable-http-keep-alive=true --enable-http-pipelining=true --disable-ipv6=true --connect-timeout=120 --max-concurrent-downloads=3  --max-connection-per-server=16" --postprocessor-args       "-hide_banner -strict experimental -threads 16 -loglevel info -flags "+low_delay+global_header-unaligned-ilme-cgop-loop-output_corrupt"  -flags2"+fast+ignorecrop+showall+export_mvs" -fflags "+genpts+nofillin+discardcorrupt-fastseek-ignidx" -movflags "+faststart+disable_chpl" -mpv_flags "+strict_gop+naq" -avoid_negative_ts "make_zero" -segment_time_metadata "1" -force_duplicated_matrix "1" -tune "zerolatency" -map_chapters "-1" -map_metadata "-1"" --ffmpeg-location          "D:/DOS/YOUTUB~1/" --recode-video "mp4" --merge-output-format      "mp4" --format "best[ext=mp4][height <=? 720]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=mp3]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=m4a]" --verbose --print-traffic --abort-on-error --http-chunk-size "10M" --force-ipv4 --geo-bypass --no-check-certificate --prefer-insecure --no-call-home --batch-file "list1.txt"

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--external-downloader', 'aria2c', '--external-downloader-args', '--file-allocation=prealloc --human-readable=true --enable-color=true --split=3 --save-session-interval=10 --auto-save-interval=10 --retry-wait=3 --max-tries=10 --timeout=120 --connect-timeout=300 --max-file-not-found=3 --continue=true --allow-overwrite=false --auto-file-renaming=false--check-integrity=false --enable-http-keep-alive=true --enable-http-pipelining=true --disable-ipv6=true --connect-timeout=120 --max-concurrent-downloads=3  --max-connection-per-server=16', '--postprocessor-args', '-hide_banner -strict experimental -threads 16 -loglevel info -flags +low_delay+global_header-unaligned-ilme-cgop-loop-output_corrupt  -flags2 +fast+ignorecrop+showall+export_mvs -fflags +genpts+nofillin+discardcorrupt-fastseek-ignidx -movflags +faststart+disable_chpl -mpv_flags +strict_gop+naq -avoid_negative_ts make_zero -segment_time_metadata 1 -force_duplicated_matrix 1 -tune zerolatency -map_chapters -1 -map_metadata -1', '--ffmpeg-location','D:/DOS/YOUTUB~1/', '--recode-video', 'mp4', '--merge-output-format', 'mp4', '--format', 'best[ext=mp4][height <=? 720]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=mp3]/bestvideo[ext=mp4][height <=? 720]+bestaudio[ext=m4a]', '--verbose', '--print-traffic', '--abort-on-error', '--http-chunk-size', '10M', '--force-ipv4', '--geo-bypass', '--no-check-certificate', '--prefer-insecure', '--no-call-home', '--batch-file', 'list1.txt']
[debug] Batch file urls: ['https://www.youtube.com/watch?v=Fy8l1POkotM&disable_polymer=1']
[debug] Encodings: locale cp1255, fs mbcs, out cp65001, pref cp1255
[debug] youtube-dl version 2018.02.03
[debug] Python version 3.4.4 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-87353-g183fd30, ffprobe N-87353-g183fd30
[debug] Proxy map: {'https': 'https://127.0.0.1:8888', 'http': 'http://127.0.0.1:8888', 'ftp':'ftp://127.0.0.1:8888'}
[youtube] Fy8l1POkotM: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it> (caused by URLError(ConnectionRefusedError(10061, 'No connection could be made because the target machine actively refused it', None, 10061, None),))
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\extractor\common.py", line 517, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\YoutubeDL.py", line 2198, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 464, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 482, in _open
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpgsc1affm\build\youtube_dl\utils.py", line 933, in http_open
  File "C:\Python\Python34\lib\urllib\request.py", line 1185, in do_open


ERRORLEVEL ==== 0


Completed Successfully!

Press any key to continue . . .
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 9, 2018

Most likely #13855 (comment)

C:\temp>C:\Users\User\Downloads\youtube-dl.exe Fy8l1POkotM
[youtube] Fy8l1POkotM: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [Errno 11004] getaddrinfo failed> (caused by URLError(gaierror(11004, 'getaddrinfo failed'
),))

C:\temp>echo %ERRORLEVEL%
1
@eladkarako
Copy link
Author

@eladkarako eladkarako commented Feb 9, 2018

it does runs in the same cmd process though..

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 9, 2018

In any case the problem is outside youtube-dl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.