Search code examples
pythonpython-py

Too many values to unpack in pytube module problem


Monday 27 jul 2020, I'm running pytube module perfectly but after one day later its code is not working any more. It's show's too many values to unpack (expected 2)

from pytube import YouTube
url = input ("Entry url : ")
yt = YouTube(url)
captions = yt.captions.get_by_language_code('en')
all = captions.generate_srt_captions()
print(all)

Anyone know this ? Or other modules like this to extract YouTube captions ?


Solution

  • Here is the solution.

    In the file: pytube/cipher.py, instead of:

    r'\b(?P<sig>[a-zA-Z0-9$]{2})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)'
    

    use:

    r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)'