0
from pytube import YouTube
url="https://youtu.be/N2TW4cko1DM"
video=YouTube(url)
print(video.title)
for stream in video.streams():
    print(stream)

run:


RegexMatchError Traceback (most recent call last) File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/main.py:181, in YouTube.fmt_streams(self) 180 try: --> 181 extract.apply_signature(stream_manifest, self.vid_info, self.js) 182 except exceptions.ExtractError: 183 # To force an update to the js file, we clear the cache and retry File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/extract.py:409, in apply_signature(stream_manifest, vid_info, js) 401 """Apply the decrypted signature to the stream manifest. 402 403 :param dict stream_manifest: (...) 407 408 """ --> 409 cipher = Cipher(js=js) 411 for i, stream in enumerate(stream_manifest): File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/cipher.py:43, in Cipher.init(self, js) 38 self.js_func_patterns = [ 39 r"\w+.(\w+)(\w,(\d+))", 40 r"\w+[("\w+")](\w,(\d+))" 41 ] ---> 43 self.throttling_plan = get_throttling_plan(js) 44 self.throttling_array = get_throttling_function_array(js) File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/cipher.py:405, in get_throttling_plan(js) 393 """Extract the "throttling plan". 394 395 The "throttling plan" is a list of tuples used for calling functions (...) 403 The full function code for computing the throttlign parameter. 404 """ --> 405 raw_code = get_throttling_function_code(js) 407 transform_start = r"try{" File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/cipher.py:311, in get_throttling_function_code(js) 310 # Begin by extracting the correct function name --> 311 name = re.escape(get_throttling_function_name(js)) 313 # Identify where the function is defined File /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pytube/cipher.py:296, in get_throttling_function_name(js) 294 return array[

codester_09
  • 5,622
  • 2
  • 5
  • 27
Jack Alvin
  • 11
  • 1
  • 2
  • 1
    Probably a duplicate of [this Q&A](https://stackoverflow.com/q/68945080/5320906) – snakecharmerb May 08 '22 at 11:20
  • This is a [bug in pytube](https://github.com/pytube/pytube/issues/1311). A [fix](https://github.com/pytube/pytube/pull/1312/files) has already been developed but not published yet. Just edit `site-package/pytube/cypher.py` manually – Tranbi May 08 '22 at 11:30
  • And what is this: function_patterns = [ r'a\.[A-Z]&&\(b=a\.get\("n"\)\)&&\(b=([^(]+)\(b\)', ] – Jack Alvin May 08 '22 at 12:49

0 Answers0