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

Retry download when getting WinError 10060 instead of hard exit #21235

Closed
MikuAuahDark opened this issue May 28, 2019 · 2 comments
Closed

Retry download when getting WinError 10060 instead of hard exit #21235

MikuAuahDark opened this issue May 28, 2019 · 2 comments
Labels

Comments

@MikuAuahDark
Copy link

@MikuAuahDark MikuAuahDark commented May 28, 2019

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2019.05.20
  • I've searched the bugtracker for similar feature requests including closed ones

Description

I'd like to request a feature where it retry to download video when WinError 10060 occured. My internet is not that good and I'm getting this at random occasion. Of course, when I re-invoke the same command it tries to resume where I left off, but again because my internet is not very good, it happends again at random occasion. It's somewhat annoying because when I start invoking the command, I just left the command running in background and doing anything else for few minutes and got disappointment when it actually fails to download because WinError 10060. It would probably a good idea to retry few times and if error keeps occuring, then give up.

Please do not tell me to fix my internet. This is somewhat the decent internet I can get in my area and I have no idea if my ISP is able to fix this.

I attached traceback it occured. I don't know if it's relevant for feature request but I'll put it anyway.

C:\Users\MikuAuahDark>youtube-dl -vf bestaudio https://www.youtube.com/watch?v=cAPYV-Uw19o
[debug] System config: []
[debug] User config: ['--no-mtime']
[debug] Custom config: []
[debug] Command-line args: ['-vf', 'bestaudio', 'https://www.youtube.com/watch?v=cAPYV-Uw19o']
[debug] Encodings: locale cp65001, fs mbcs, out cp65001, pref cp65001
[debug] youtube-dl version 2019.05.20
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17763
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1
[debug] Proxy map: {}
[youtube] cAPYV-Uw19o: Downloading webpage
[youtube] cAPYV-Uw19o: Downloading video info webpage
[debug] Invoking downloader on 'https://r4---sn-uigxxi0ujipnvo-02be.googlevideo.com/videoplayback?id=o-AL1yk9HKlMAFiQTp4N5j2_GE1IFn8rfWYI-d1nKDC-A9&itag=171&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-uigxxi0ujipnvo-02be%2Csn-npoeen7d&ms=au%2Crdu&mv=m&pl=24&ei=WLrsXLrWLZim8gOazZaICA&initcwndbps=165000&mime=audio%2Fwebm&gir=yes&clen=8735460&dur=468.585&lmt=1523116356978089&mt=1559017992&fvip=6&keepalive=yes&c=WEB&ip=202.67.37.17&ipbits=0&expire=1559039673&sparams=ip%2Cipbits%2Cexpire%2Cid%2Citag%2Csource%2Crequiressl%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cei%2Cinitcwndbps%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&signature=3476634874B322C3FC5731156E1FF4DEFF3CE41F.A50CBC6CE8E0570261CEDC7A3CE43E4A3779BD1C&key=yt8&ratebypass=yes'
ERROR: unable to download video data: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
Traceback (most recent call last):
  File "C:\Python\Python34\lib\urllib\request.py", line 1183, in do_open
  File "C:\Python\Python34\lib\http\client.py", line 1137, in request
  File "C:\Python\Python34\lib\http\client.py", line 1182, in _send_request
  File "C:\Python\Python34\lib\http\client.py", line 1133, in endheaders
  File "C:\Python\Python34\lib\http\client.py", line 963, in _send_output
  File "C:\Python\Python34\lib\http\client.py", line 898, in send
  File "C:\Python\Python34\lib\http\client.py", line 1279, in connect
  File "C:\Python\Python34\lib\http\client.py", line 871, in connect
  File "C:\Python\Python34\lib\socket.py", line 516, in create_connection
  File "C:\Python\Python34\lib\socket.py", line 507, in create_connection
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\YoutubeDL.py", line 1915, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\YoutubeDL.py", line 1854, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\downloader\common.py", line 364, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\downloader\http.py", line 341, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\downloader\http.py", line 109, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpt31j5y3w\build\youtube_dl\YoutubeDL.py", line 2227, 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\ytdl-org\tmpt31j5y3w\build\youtube_dl\utils.py", line 1140, in https_open
  File "C:\Python\Python34\lib\urllib\request.py", line 1185, in do_open
urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 28, 2019

For any work on this you must provide reproducible environment.

@dstftw dstftw closed this May 28, 2019
@numlockkey
Copy link

@numlockkey numlockkey commented Apr 8, 2020

I'm having the same problem.

Solution should be a simple 1 line of code:

if WinError 10060 then retry

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
3 participants
You can’t perform that action at this time.