cyfung1031 / userscript-supports

This is for the userscripts created on GreasyFork.org.
https://cyfung1031.github.io/userscript-supports/
MIT License
48 stars 3 forks source link

Restore YouTube Username from Handle to Custom: Not working in Desktop Firefox when logged in #9

Closed R3G3N3R4T0R closed 1 year ago

R3G3N3R4T0R commented 1 year ago

I suppose it is the same cause as https://github.com/yakisova41/return-youtube-comment-username/issues/43, with its corresponding fix https://github.com/yakisova41/return-youtube-comment-username/commit/8da40a3746f3d78ae3e382e2ca13af598561d2f4.

The script would not work on desktop Firefox when logged in. It works properly when not logged in on Firefox or if using chromium based browsers either logged in or not. No request is made to fetch the username in the Network tab, but I do not see any extra error messages either.

Reproduction Steps

  1. Create a new profile in Firefox, load in TamperMonkey/ViolentMonkey and your script from GreasyFork.
  2. Open www.youtube.com and pick a video, better pause once the video is loaded but not required.
  3. Scroll down and YouTube comments should have usernames, new browser?key= requests would appear if Network tab is open.
  4. Log in to YouTube, and return to the same video.
  5. Scroll down and YouTube comments should have handles, new browser?key= requests would not appear if Network tab is open.

Versions Tested

cyfung1031 commented 1 year ago

Thanks for reporting.

Please update to the latest version (>=0.5.16). Please close the issue if it works for you.

Detailed Explanation

This issue is due to YouTube native coding issue for their custom elements implementation in Firefox. Therefore, it is not directly related to the account login status. It is not related to UserScript manager you used. (I used private mode in Firefox 88 to reproduce the issue without login.)

This issue would not happen in Chrome because Chrome and YouTube both belong to Google.

Remarks

Just be reminded that your account is associated with the older version of Firefox. I do not know any solution for it. You can verify that using your Firefox with v0.5.10 to login another account. As that account is used with your latest Firefox as a first time of usage, such problem would not appear.

Latest Firefox - document.querySelector('ytd-watch-flexy').firstElementChild === null in console window is false Your account recognized as older version - document.querySelector('ytd-watch-flexy').firstElementChild === null in console window is true

This issue (making modern browsers become obsolete browser) exists in all browsers including Firefox and Chrome. There are many many bugs and issues in YouTube coding. I think their engineers are having difficulty to maintain those codes written in previous years.

R3G3N3R4T0R commented 1 year ago

Can confirm it works now and thanks for your explanation. I didn't expect you to fix it in 2 hours at midnight.

I have attempted to remove all youtube cookies and the Firefox 114.0.2 with v0.5.10 test is done with a fresh profile as a separate instance(when my main profile is also running) logging into my main account. The problem persisted, led me to the conclusion that logging in is the cause of the issue.

PS: I have found YouTube UX becoming worse and worse, but community improvement and the creator base have sort of locked me in. I guess that have also put them in a bind if they want to keep that advantage. Rewriting it will probably just lead to another reddit situation.

cyfung1031 commented 1 year ago

From my understanding, the YouTube engine rendering is set to your account + browser application. Clear cookie or fresh profile won't help. The javascript files are the same. The difference is your web pages retrieved from YouTube server. But it usually would not create any big issue to your watching experience, just sometimes your userscripts or extensions might not work due to those weird configurations.

cyfung1031 commented 1 year ago

I just upgraded the following script to make it more powerful to reset the YouTube settings, including those related to account login issue (incorrect account authorisation settings).

https://greasyfork.org/en/scripts/457255-reset-youtube-settings

Recommend that you can use it to reset once.

You can check in console window that

Before: typing document.querySelector('ytd-watch-flexy').firstElementChild === null and press enter, show true After (success): typing document.querySelector('ytd-watch-flexy').firstElementChild === null and press enter, show false

R3G3N3R4T0R commented 1 year ago

Confirmed this fixes the issue on my account and both scripts in their affected versions operates correctly on both of my systems after resetting on one of them. Should I report it back to yakisova41? It might also be a good idea to direct users to that script as part of troubleshooting procedure.