Search code examples
pythonyoutubeyoutube-dlpytube

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


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.


Solution

  • 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