Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 747
Abhijit Mondal Avatar asked Oct 16 '22 01:10

Abhijit Mondal


1 Answers

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*\)'
like image 85
user14010779 Avatar answered Oct 19 '22 00:10

user14010779