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

bash script loop exits prematurely on youtube-dl connection error #6021

Closed
fugu2u opened this issue Jun 18, 2015 · 4 comments
Closed

bash script loop exits prematurely on youtube-dl connection error #6021

fugu2u opened this issue Jun 18, 2015 · 4 comments

Comments

@fugu2u
Copy link

@fugu2u fugu2u commented Jun 18, 2015

Using youtube-dl in a for loop, where it shouldn't end the loop, but this error causes the for to break;
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'--user-agent', u'Mozilla/5.0 ;Windows NT 6.1; WOW64; Trident/7.0; rv:11.0; like Gecko', u'--restrict-filenames', u'-c', u'-r', u'20k', u'https://www.youtube.com/watch?v=1biIRxTRCS8']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.06.15
[debug] Python version 2.7.6 - Linux-3.16.0-41-generic-x86_64-with-Ubuntu-14.04-trusty
[debug] exe versions: avconv 9.18-6, avprobe 9.18-6, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] 1biIRxTRCS8: Downloading webpage
[youtube] 1biIRxTRCS8: Extracting video information
[youtube] 1biIRxTRCS8: Downloading DASH manifest
WARNING: Your copy of avconv is outdated and unable to properly mux separate video and audio files, youtube-dl will download single file media. Update avconv to version 10-0 or newer to fix this.
[debug] Invoking downloader on u'https://r2---sn-fvf-qufe.googlevideo.com/videoplayback?mt=1434657155&initcwndbps=1741250&expire=1434678792&signature=0AFF9BC4F7FC92DBA9811C01DE96DA10FD123300.E7A87E7A1483380EA524E944A264AA7417070005&upn=C9npayIpIe8&mime=video%2Fmp4&sver=3&itag=22&pl=22&source=youtube&mv=m&ms=au&ip=XXX.XXX.XXX.XXX&key=yt5&lmt=1394258535176683&pcm2cms=yes&fexp=9407141%2C9408133%2C9408142%2C9408144%2C9408420%2C9408710%2C9412843%2C9413113%2C9413503%2C9415304%2C9415758%2C9415811%2C9416052%2C9416126%2C9416504%2C9416654%2C952626&mm=31&mn=sn-fvf-qufe&id=o-AKSR6kHsI_t0C1GcxwFGAJa-K7uyi88P3lsT5mQgNdJT&dur=93.437&requiressl=yes&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ipbits=0&ratebypass=yes'
ERROR: unable to download video data: <urlopen error [Errno 111] Connection refused>
Traceback (most recent call last):
File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1435, in process_info
success = dl(filename, info_dict)
File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1377, in dl
return fd.download(name, info)
File "/usr/bin/youtube-dl/youtube_dl/downloader/common.py", line 342, in download
return self.real_download(filename, info_dict)
File "/usr/bin/youtube-dl/youtube_dl/downloader/http.py", line 59, in real_download
data = self.ydl.urlopen(request)
File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1730, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 442, in error
result = self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 629, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/bin/youtube-dl/youtube_dl/utils.py", line 713, in https_open
req, *_kwargs)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused>

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 19, 2015

Not sure why. Could you add the -g option, for example:

youtube-dl -g -v --user-agent "Mozilla/5.0 ;Windows NT 6.1; WOW64; Trident/7.0; rv:11.0; like Gecko" --restrict-filenames -c -r 20k "https://www.youtube.com/watch?v=1biIRxTRCS8"

And paste the resultant URLs to browsers?

@fugu2u
Copy link
Author

@fugu2u fugu2u commented Jun 19, 2015

there are times when connectivity goes down when using this application, but the script is suppose to keep running. For some reason when youtube-dl catches an error instead of just exiting from python, it kills the parent bash script as well. It's almost like a sys.exit is being called when it would be better if a return 1 should be called

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jun 19, 2015

The issue is probably in the script, as far as I know sys.exit just closes the python program and returns the given error status, I really doubt it can interfere with the calling script. Please post the script you are using (or the minimim part that reproduces the problem).

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jun 21, 2015

I'm closing the issue since we need more info to verify it's an actual youtube-dl issue.

@jaimeMF jaimeMF closed this Jun 21, 2015
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.