Open SpyroTEQ opened 1 year ago
For me the base.js didn't change yet: https://www.youtube.com/s/player/23604418/player_ias.vflset/en_US/base.js
Try with this line:
ytMainFuncBody = getMyContent(ytScriptUrl, new RegExp('(?:^|;)' + ytMainFuncName.replace(/\$/, '\\$') + '\\s*=\\s*function\\s*' + '\\s*\\(\\w+\\)\\s*\\{(.*?\\))\\};'));
Well, I wanted to reproduce the issue to test your suggested change (which I think would work seeing the regex and looks way better), so I reverted my changes, but I could not reproduce my yesterday issue :/ I redownloaded the original 2022.07.11 from Gitlab but again, it seems the issue is no longer reproducible
If I end up crossing the path of the same bug, I'll give a try to your suggested change and I'll let you know it that works nice
Thanks! :) And sorry for not being able to reproduce my own bug today :/
The base.js file is not always needed or it doesn't always have the string that breaks the script. New versions of the script uses the Android API which doesn't need the js file: http://sebaro.pro/savetube/files/savetubetest.user.js
Ah, the issue happened again on https://www.youtube.com/watch?v=pNjFqW4amGQ
I've just tested your suggestion and it indeed works like a charm ! Thanks for the patch :)
Hi, This evening, the Savetube script (2022.07.11) stopped working on Youtube for Firefox Digging in the console, we get:
The erroneous line at 799 is
Adding some console logs, it seems the body of the parsed ytMainFuncBody function is:
which looks indeed truncated From the original script https://www.youtube.com/s/player/1dda5629/player_ias.vflset/fr_FR/base.js we see a regex
/()\/"()(;)[;,'};]();/
which holds a dandling "}", that probably breaks the parserAs a quick and dirty fix, I made the "parseMyContent" function as below:
By replacing the regex with dandling "}" before running the parsing Regex of line 797 (
ytMainFuncBody = getMyContent(ytScriptUrl, new RegExp('(?:^|;)' + ytMainFuncName.replace(/\$/, '\\$') + '\\s*=\\s*function\\s*' + '\\s*\\(\\w+\\)\\s*\\{(.*?)\\};'));
) I get a properly parsed youtube script and SaveTube works againI'm not opening a pull request here, because this is clearly not a nice "fix", but I wanted to share my root cause analysis of this issue so you may find a proper fix quicker and easier :)
(Note: since I edited this parseMyContent, i'm not 100% of my line numbers in this issue)