Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pytube: AttributeError: 'NoneType' object has no attribute 'span' cipher.py [duplicate]

Yesterday this works fine, today i'm getting error on my local machine, colab notebook, even on my VPS.

/usr/local/lib/python3.9/dist-packages/pytube/cipher.py in get_throttling_plan(js)
    409     match = plan_regex.search(raw_code)
    410 
--> 411     transform_plan_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)
    412 
    413     # Steps are either c[x](c[y]) or c[x](c[y],c[z])

from pytube import YouTube def audio_download(video_url): audio_file = YouTube(video_url).streams.filter(only_audio=True).first().download(filename="audio.mp4") return 'ok'

Expected to download audio. I even tried to changes in cipher.py file as said in other solution but not working.

like image 776
Mohamed Hasan Avatar asked Sep 03 '25 16:09

Mohamed Hasan


1 Answers

Found a solution. cipher.py Line 411

transform_plan_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)

to

transform_plan_raw = js
like image 191
s4ch Avatar answered Sep 05 '25 10:09

s4ch