distubejs / ytdl-core

YouTube video downloader in javascript.
MIT License
206 stars 43 forks source link

Error 403 Could not parse n transform function #91

Closed luthfipun closed 1 month ago

luthfipun commented 1 month ago

Describe the bug

It seems that base.js has been updated, and the decipher function no longer works.

Debug File

1723680851971-base.zip

Environment

luthfipun commented 1 month ago

fixes with this regexps

const N_TRANSFORM_REGEXP = 'function\\(\\s*(\\w+)\\s*\\)\\s*\\{' +
  'var\\s*(\\w+)=(?:\\1\\.split\\(.*?\\)|String\\.prototype\\.split\\.call\\(\\1,.*?\\)),' +
  '\\s*(\\w+)=(\\[.*?]);\\s*\\3\\[\\d+]' +
  '(.*?try)(\\{.*?})catch\\(\\s*(\\w+)\\s*\\)\\s*\\' +
  '{\\s*return"enhanced_except_([A-z0-9-]+)"\\s*\\+\\s*\\1\\s*}' +
  '\\s*return\\s*(\\2\\.join\\(""\\)|Array\\.prototype\\.join\\.call\\(\\2,""\\))};';