-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
youtube_dl.jsinterp.JSInterpreter.Exception: slice must be applied on a list in: 'a.slice(0,0) #32896
Comments
related: yt-dlp/yt-dlp@bb8bf1d, yt-dlp/yt-dlp@c86891e |
Slicing patch for yt-dl, where we can't say --- old/youtube-dl/youtube_dl/jsinterp.py
+++ new/youtube-dl/youtube_dl/jsinterp.py
@@ -925,9 +925,11 @@
obj.reverse()
return obj
elif member == 'slice':
- assertion(isinstance(obj, list), 'must be applied on a list')
- assertion(len(argvals) == 1, 'takes exactly one argument')
- return obj[argvals[0]:]
+ assertion(isinstance(obj, (list, compat_str)), 'must be applied on a list or string')
+ assertion(len(argvals) <= 2, 'takes between 0 and 2 arguments')
+ if len(argvals) < 2:
+ argvals += (None,)
+ return obj[slice(*argvals)]
elif member == 'splice':
assertion(isinstance(obj, list), 'must be applied on a list')
assertion(argvals, 'takes one or more arguments') |
it look like i have the same issue :
|
Will this keep breaking every two days because youtube combats it, or is this just sloppy code when something expects a list but it happens to not be one? |
want to know that as well, is there any stable solution? does google provide any api to download? |
Good question. And answer we can only guess, and the guess is yes. |
it works more often now but I am still getting this dang 403 error on some videos
|
There are two targets here, basically because yt-dl is by design not Chrome, nor even Firefox.
The issue here is a good example. The interpreter has long supported the JS To implement the method (more) properly, we have to observe the following:
In this case, more of the fix is about fixing the original assumptions than fixing the slicing. |
I suppose the empire is striking back lately. Thank you for the fix. |
Also thanks to @seproDev for the original yt-dlp fix and accompanying extensive test suite. |
I'm using the latest nightly build and I'm getting the 403 error on various videos. Strangely, it always seems to happen on the videos I actually WANT to download, while pretty much every other video I try just as a test, works fine. I've compared the formats available, tried downloading specific formats, etc, and there doesn't seem to be any pattern to it. Right now, it seems completely incapable of downloading these two URLs; https://www.youtube.com/watch?v=_qMlE4XHs4c Here's the part I don't get: The last time I updated the version of yt-dlp (backported to my old system by nicolaasjan, was on 7/31/24, and that version has no trouble downloading the same videos. In fact, I don't think I've seen a single 403 error while using it. I prefer youtube-dl though. Mostly because it runs faster. |
As always, try some different network connection. Despite finding the - 'clientVersion': '2.20201021.03.00',
+ 'clientVersion': '2.20220801.00.00', but we are getting the web data from the web page, not the API. Also, isn't 2022... (the Web client version from current yt-dlp) quite a long internet-time ago?
|
@dirkf |
Call me dumb, but I'm not sure what you mean by trying different network connections. As for "testing", what I meant was that I picked various other videos and tried downloading them as a test, and it seems to work with videos that I don't care about, but when I actually WANT to download a video, all I get are 403 errors. For the record, I still can't download the two URLs in my previous post. Here is the result of using --verbose; [debug] System config: [] |
Indeed, the problem is presumably #32905 and independent of connection type. |
Checklist
Verbose log
Description
WRITE DESCRIPTION HERE
The text was updated successfully, but these errors were encountered: