python 3.8
pytube.__version__ ---> '9.6.4'
ERROR:
File "C:\Users........\anaconda3\lib\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
KeyError: 'assets'
same problem here
having same issue
Same issue here
It seems that we all have the same problem :)
This error happens sometimes,sometimes it does not. :|
Looking into a fix for this now
This seems to be an issue with YouTube returning incomplete responses some of the time.
Example successful response:

Example unsuccessful response:

Not 100% sure this is something we can fix on the pytube side since this is extracted directly from the page HTML, but I'm going to look into it a bit more.
This error happens sometimes,sometimes it does not. :|
Same here
I would recommend to throw a usefull exception to let the user implement a solution.
Von: Victor Josso notifications@github.com
Gesendet: Saturday, October 24, 2020 1:29:40 AM
An: nficano/pytube pytube@noreply.github.com
Cc: Subscribed subscribed@noreply.github.com
Betreff: Re: [nficano/pytube] KeyError: 'assets' (#763)
This error happens sometimes,sometimes it does not. :|
Same here
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/nficano/pytube/issues/763#issuecomment-715631350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB4OLEFNCRF6MXBY67AWTVTSMIGWJANCNFSM4S3XAXOQ.
I found a solution for this particular KeyError problem, but it looks like the problem goes a bit deeper than just this part of the code. Working on something more robust right now.
I found a solution for this particular KeyError problem, but it looks like the problem goes a bit deeper than just this part of the code. Working on something more robust right now.
Good look, keep us updated
It might be a little while before this gets merged, so consider checking out my forked branch to test if it works for you -- I'm no longer running into problems with it, but would appreciate additional eyes with more use cases.
same issue here,sometimes work sometimes dont,
Thank you @tfdahlin!
Where can we see the "beta solution" for this problem? I want to try it myself if you say its fixed for you @tfdahlin so I can give feedback. Thanks for all the effort.
@ElZanaorio the solution actually just got merged into this repo, so you should be able to give it a go with this repository now.
@RONNCC can you close this issue? It was solved by https://github.com/nficano/pytube/pull/767
Fixed by #767
Thanks for the fix !!
Thannnnks <3
Quick fix, change (Alternate solution)
def js_url(html: str) -> str:
base_js = re.search("\/s\/player.*\/base\.js", html).group()
return "https://youtube.com" + base_js
@rajkarthy what is the context?
@RONNCC I think @rajkarthy is offering another solution to the one that got merged, and didn't realize this issue was already fixed
@RONNCC @tfdahlin Yes its an alternative with a small change
@rajkarthy feel free to submit a PR if there is benefit :)
Is this already on Pypi? I just pip installed latest version and I am still getting the issue. Do I have to build from source?
@klaymond this is not on pypi currently, and I believe the pypi package is broken. We're trying to get the repo owner to update the pypi package, but in the meantime, you can use python -m pip install git+https://github.com/nficano/pytube to install the most up-to-date version.
Thanks!
@klaymond I just managed to update PyPi (wasn't working before) -- should work now
Most helpful comment
Quick fix, change (Alternate solution)