Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in browsers without ECMAScript 2020 support #57

Closed
computerfan0 opened this issue Aug 23, 2021 · 51 comments · Fixed by #63
Closed

Not working in browsers without ECMAScript 2020 support #57

computerfan0 opened this issue Aug 23, 2021 · 51 comments · Fixed by #63

Comments

@computerfan0
Copy link

I am trying to watch age restricted videos but am still getting forced to verify my ID even though I am using both this script and a VPN set to Canada.

@zerodytrash
Copy link
Owner

Please provide the link to the video and the error message from the developer console (F12)

@computerfan0
Copy link
Author

I was getting it on various videos but can't remember any of them. They came up when searching for "age restricted test".

@zerodytrash
Copy link
Owner

  • what browser are you using?
  • do you see a red "Unable to unlock this video :(" message below the player?
  • what error message do you find in the developer console?

I need more information otherwise I can't help you.

@krystian3w
Copy link

krystian3w commented Aug 24, 2021

Script may no works with Waterfox Classic 2021.04 - detected by @decembre.

I no tested this with Waterfox Classic 2021​.07 - I only know in next classic release programmers try overidde UA to emulate useage Firefox 68.

@zerodytrash
Copy link
Owner

Script may no works with Waterfox Classic 2021.04

Yes, thats because Waterfox Classic doesn't support ECMAScript 2020 features like "optional chaining" used by this script :(

@decembre
Copy link

Thanks:
My report about this problem to Waterfox:
[WaterFox Classic] Unsupported JS functions/API ? - (Make an userscript Unusable with Waterfox Classic) #2221

@xlovinglyx
Copy link

HI zerody, not working here either.

I confirm you the same issue with Palemoon as with Waterfox. a workaround would be nice.

@xlovinglyx
Copy link

@drunkwinter
Copy link
Collaborator

At some point we could make a build step and compile the release to be compatible with older browsers. Might give it a try if this is needed.

@xlovinglyx
Copy link

that would be wonderful ))

@krystian3w
Copy link

9OTkhsJUK0U

works on Firefox 91.0.3, so no geolocked and not hidden by paid membership if broken with your Firefox 91 / Chrome 92 (and other updated chromium browser) / Safari 14 so needed is error log from dev tools console.

For PaleMoon/Basilisk/Waterfox Classic maybe better create mega theard as new issue.

@zerodytrash zerodytrash changed the title Not working Not working in browsers without ECMAScript 2020 support Aug 29, 2021
@drunkwinter
Copy link
Collaborator

I'm currently working on it as seen above. Are any of you willing to test this out and report back if this fixes the issue?

Simple-YouTube-Age-Restriction-Bypass.user.zip

@decembre
Copy link

I'm currently working on it as seen above. Are any of you willing to test this out and report back if this fixes the issue?

Tested (tampermonkey + Waterfox Classic 56.5) but not working:
Go to the Login page....
;-(

Note it's maybe due to the formating?
After copy/paste in tampermonkey editor , i see a red cross error before your code....

@krystian3w
Copy link

But still works in Firefox 92 + Tampermonkey.

@xlovinglyx
Copy link

not working on palemoon.

@drunkwinter

This comment has been minimized.

@drunkwinter
Copy link
Collaborator

Ok after hard looking I think I'm confident that I've found the problem and a possible solution. This is probably gonna be a 2 stage fix.

@zerodytrash
Copy link
Owner

In Waterfox Classic the execution works with the following babel.config.js preset:

targets: {
    firefox: "47",
  },

@drunkwinter
Copy link
Collaborator

In Waterfox Classic the execution works with the following babel.config.js preset:

targets: {
    firefox: "47",
  },

@zerodytrash Second problem lies here. window.eval or initUnlocker.toString() somehow corrupts the code and we get ReferenceError: _typeof is not defined on Palemoon. Without the if check (executing the function directly) it works as expected.
Do we still need the eval call?

if ((typeof GM_info === "undefined" ? "undefined" : _typeof(GM_info)) === "object" && GM_info.scriptHandler === "Greasemonkey") {
    window.eval("(" + initUnlocker.toString() + ")();");
} else {
    initUnlocker();
}

@zerodytrash
Copy link
Owner

Do we still need the eval call?

A direct execution (without eval) would not work with Greasemonkey. Tampermonkey and other script managers have no problems with it.

@drunkwinter
Copy link
Collaborator

drunkwinter commented Aug 31, 2021

Do we still need the eval call?

A direct execution (without eval) would not work with Greasemonkey. Tampermonkey and other script managers have no problems with it.

That's the weird thing, because I used Greasemonkey since it looks like it's the only option for Palemoon.

@zerodytrash
Copy link
Owner

window.eval or initUnlocker.toString() somehow corrupts the code and we get ReferenceError: _typeof is not defined on Palemoon. Without the if check (executing the function directly) it works as expected.

I assume the following (not tested):
window.eval is executed in a different context and the helper variable (?) _typeof is only present in the script context. Greasemonkey separates the script from the window context. This is a part of the security model. So _typeof would have to be transferred to the window first. Babel is probably not designed for this.

@drunkwinter
Copy link
Collaborator

drunkwinter commented Sep 1, 2021

window.eval or initUnlocker.toString() somehow corrupts the code and we get ReferenceError: _typeof is not defined on Palemoon. Without the if check (executing the function directly) it works as expected.

I assume the following (not tested):
window.eval is executed in a different context and the helper variable (?) _typeof is only present in the script context. Greasemonkey separates the script from the window context. This is a part of the security model. So _typeof would have to be transferred to the window first. Babel is probably not designed for this.

We could maybe use a different injection method to get around this. What do you think?

const nScript = createElement('script', { innerHTML: "(" + initUnlocker.toString() + ")();" });
document.head.append(nScript);

@zerodytrash
Copy link
Owner

zerodytrash commented Sep 1, 2021

We could maybe use a different injection method to get around this. What do you think?

The web page (YouTube) does not know _typeof, because declarations from the script context (outside the initUnlocker function) are not available through the window.

@zerodytrash
Copy link
Owner

zerodytrash commented Sep 1, 2021

Is there perhaps a way to tell babel to declare such variables per function instead globally?

@drunkwinter
Copy link
Collaborator

drunkwinter commented Sep 1, 2021

Is there perhaps a way to tell babel to declare such variables per function instead globally?

Was just about to give up and then I got a clever idea ;)

Check if the IIFE has a argument (which it won't the first time), then call the IIFE with window.eval with a true argument.
This time the argument check will be true, which will fire initUnlocker() in the else statement

if (typeof GM_info === "object" && GM_info.scriptHandler === "Greasemonkey" && !arguments[0]) {
    window.eval("(" + arguments.callee.toString() + ")(true);");
} else {
    initUnlocker();
}

We also need to pass the strict: false option to Rollup, because arguments.callee does not work in strict mode.

This would be more than fine, until we find a way to do it within the bundle process.

@xlovinglyx
Copy link

if i get it right drunkwinter, u found an idea but havent got time to completly write it for the final js ?

@drunkwinter
Copy link
Collaborator

if i get it right drunkwinter, u found an idea but havent got time to completly write it for the final js ?

Not at all, consider it almost done ;)
This one should hopefully work.

Simple-YouTube-Age-Restriction-Bypass.user.zip

@decembre
Copy link

decembre commented Sep 1, 2021

Tested for:
https://www.youtube.com/watch?v=9OTkhsJUK0U
with:
Tampermonkey + Waterfox Classic 56.5
WORK fine!
;-)

@drunkwinter
Copy link
Collaborator

Tested for:
https://www.youtube.com/watch?v=9OTkhsJUK0U
with:
Tampermonkey + Waterfox Classic 56.5
WORK fine!
;-)

Happy to hear!

Can you do one last test for me please and see if this one works too?

Simple-YouTube-Age-Restriction-Bypass.user.zip

@decembre
Copy link

decembre commented Sep 1, 2021

Re -Tested with your very last version:
Tampermonkey + Waterfox Classic 56.5
On video:
https://www.youtube.com/watch?v=9OTkhsJUK0U
All is working too.
Fast and perfect.
Thanks....

@xlovinglyx
Copy link

You're the king drunk winter! i was finding it sooo creepy that youtube asks the scanning of an id to then resell private information. works like a charm ))

@xlovinglyx
Copy link

Hi drunkwinter, this has nothing to do with the topic but since u seem to know how to play with greasemonkey for palemoon,
i was wondering if you could fix this: https://chrome-extension-downloader.com/0deebe7f3cbee2ca25c97cbaa54c78f0/https://chrome.google.com/webstore/detail/auto-replay-for-youtube/mcdpnidfhfjfbafmpppcplcejgepadbo?hl=en-US&gl=CA.crx

it stopped working on youtube, i still have the script of version code 3.3 & the script part of 3.4 above re-added to greasemonkey didn't work..

@drunkwinter

This comment has been minimized.

@krystian3w

This comment has been minimized.

@drunkwinter

This comment has been minimized.

@krystian3w

This comment has been minimized.

@drunkwinter

This comment has been minimized.

@krystian3w

This comment has been minimized.

@drunkwinter

This comment has been minimized.

@krystian3w

This comment has been minimized.

@xlovinglyx
Copy link

"Maybe what @xlovinglyx uses? https://chrome-extension-downloader.com/"

No drunkwinter, (I'm a pale moon user, your previous fix for waterfox worked in palemoon too)

I was asking a script based fix, & all other comments, made a point, the addon loops specific parts
People would like to loop only like in long concerts. if you open the link i initially gave you, the crx
file, you'll have the script inside, adapting it to greasemonkey for palemoon would be as good for
palemoon as for waterfox. so it's "not useless", but it can only become a "loss" if you don't want to
fix that script for a reason or another.

@Purfview
Copy link

if i get it right drunkwinter, u found an idea but havent got time to completly write it for the final js ?

Not at all, consider it almost done ;)
This one should hopefully work.

Simple-YouTube-Age-Restriction-Bypass.user.zip

Simple-YouTube-Age-Restriction-Bypass.user.zip

Both don't work with Violentmonkey + Waterfox Classic 2021.08.1

@drunkwinter
Copy link
Collaborator

drunkwinter commented Sep 11, 2021

if i get it right drunkwinter, u found an idea but havent got time to completly write it for the final js ?

Not at all, consider it almost done ;)
This one should hopefully work.
Simple-YouTube-Age-Restriction-Bypass.user.zip

Simple-YouTube-Age-Restriction-Bypass.user.zip

Both don't work with Violentmonkey + Waterfox Classic 2021.08.1

Tested it on Waterfox Classic 2021.08.1 with Violentmonkey and everything seems to work accordingly.

Make sure you disable the old version if you didn't already overwrite it, also make sure to disable all other extensions you might have and see if that works.

If you still have the issue, then it's best to wait till the patch is officially released and if you then get the same result, it might be better if you created a separate issue/report.

When the patch releases (soon) this issue will be closed.

@Purfview
Copy link

Purfview commented Sep 11, 2021

Tested it on Waterfox Classic 2021.08.1 with Violentmonkey and everything seems to work accordingly.

Make sure you disable the old version if you didn't already overwrite it, also make sure to disable all other extensions you might have and see if that works.

Created the new Waterfox Classic profile.
Restarted Waterfox Classic into the new profile.
Installed Violentmonkey 2.13
Installed Simple-YouTube-Age-Restriction-Bypass.user.zip
Tried: https://www.youtube.com/watch?v=9OTkhsJUK0U

Still I see only "Verify your age" message... it's 2021.08.1 (64-bit) on Win7.

@krystian3w
Copy link

You installed without rename/unpack?

@Purfview
Copy link

You installed without rename/unpack?

Huh, of course I extracted JS file from ZIP archive. :)

@krystian3w
Copy link

So demo links end error from devtools are needed.

We don't have 🔮.

@drunkwinter
Copy link
Collaborator

Like I said, wait for the official patch before opening a new issue. Your issue has likely nothing to do with this one.

@zerodytrash
Copy link
Owner

The latest version should be compatible with Waterfox Classic.

@Purfview
Copy link

@ DrunkWinter

Latest v2.2.1 works like a charm.
Thanks guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants