pytube: [BUG] FIX

fully working code pytube

https://github.com/oncename/pytube/tree/master

fix cipher.py

function_patterns = [
    # https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377
    # https://github.com/yt-dlp/yt-dlp/commit/48416bc4a8f1d5ff07d5977659cb8ece7640dcd8
    # var Bpa = [iha];
    # ...
    # a.C && (b = a.get("n")) && (b = Bpa[0](b), a.set("n", b),
    # Bpa.length || iha("")) }};
    # In the above case, `iha` is the relevant function name
    r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&.*?\|\|\s*([a-z]+)',
    r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])?\([a-z]\)',
]

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 51
  • Comments: 22

Commits related to this issue

Most upvoted comments

worked for me! thanks! pytube 15.0.0 python 3.11 windows 11

worked for me! thanks! pytube 15.0.0 python 3.11 windows 11

cd Documents git clone https://github.com/oncename/pytube.git cd pytube pip install .

Maybe I’ve done something wrong, but it didn’t worked to me: pytube 15.0.0 python 3.10 Windows 11

from pytube import YouTube import os url = 'https://www.youtube.com/watch?v=BVjROQirpkk' flag = True while flag: video = YouTube(url) audio = video.streams.filter(file_extension='mp4').first() audio.download("stack") for elem in os.scandir('stack'): file = elem.name print(file) flag = False

v15.0.0 itself does not work! You either need to modify cipher.py (modified last year) as described by @onename above, or clone and install the current master branch (cipher.py modified 3 days ago)

function_patterns = [ # https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377 # https://github.com/yt-dlp/yt-dlp/commit/48416bc4a8f1d5ff07d5977659cb8ece7640dcd8 # var Bpa = [iha]; # … # a.C && (b = a.get(“n”)) && (b = Bpa0, a.set(“n”, b), # Bpa.length || iha(“”)) }}; # In the above case, iha is the relevant function name r’a.[a-zA-Z]\s*&&\s*([a-z]\s*=\sa.get(“n”))\s&&.?||\s([a-z]+)‘, r’([a-z]\s*=\s*([a-zA-Z0-9$]+)([\d+])?([a-z])', ]

Got it dude, thanks. But after fixing there born another mistake

pytube.exceptions.RegexMatchError: regex_search: could not find match for ema=function\(\w\){[a-z=\.\(\"\)]*;(.*);(?:.+)}

worked for me! thanks! pytube 15.0.0 python 3.11 windows 11

cd Documents git clone https://github.com/oncename/pytube.git cd pytube pip install .