question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

yt = Youtube('https://www.youtube.com/watch?v=dkfW1Q1T72c') This code gives an error:

Traceback (most recent call last): File “views.py”, line 46, in <module> yt = YouTube(url) File “C:\Users\Diego\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube_main_.py”, line 88, in init self.prefetch_init() File “C:\Users\Diego\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube_main_.py”, line 97, in prefetch_init self.init() File “C:\Users\Diego\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube_main_.py”, line 133, in init mixins.apply_signature(self.player_config_args, fmt, self.js) File “C:\Users\Diego\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\mixins.py”, line 49, in apply_signature signature = cipher.get_signature(js, stream[‘s’]) KeyError: ‘s’

This error occurs for certain URLs but not necessarily. This problem has been bothering me for a long time, please help me solve this problem.(By the way, I am using the latest version.) Thank you!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
kaidokertcommented, May 4, 2019

Quick and small workaround for ( what seems to be the most ) of the issue: Change line 41

if ('signature=' in url):

to :

if ('signature=' in url) or ('&sig=' in url) or ('&lsig=' in url):
0reactions
heckadcommented, May 14, 2019

This video https://www.youtube.com/watch?v=cfsICOzt6Do do not download. Program failing with same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python KeyError Exceptions and How to Handle Them
The Python KeyError is a type of LookupError exception and denotes that there was an issue retrieving the key you were looking for....
Read more >
How to Fix KeyError Exceptions in Python - Rollbar
The Python KeyError is an exception that occurs when an attempt is made to access an item in a dictionary that does not...
Read more >
I'm getting Key error in python - Stack Overflow
A KeyError generally means the key doesn't exist. So, are you sure the path key exists? From the official python docs: exception KeyError....
Read more >
keyerror in Python – How to Fix Dictionary Error
When working with dictionaries in Python, a KeyError gets raised when you try to access an item that doesn't exist in a Python...
Read more >
Python KeyError: A Beginner's Guide % - Career Karma
A Python KeyError is raised when you try to access an item in a dictionary that does not exist. You can fix this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found