Better way
See original GitHub issueHello, i analysed the youtube code and what is triggering the popup is on this file https://www.youtube.com/yts/jsbin/desktop_polymer_inlined_html_polymer_flags_v2-vflNwouvq/desktop_polymer_inlined_html_polymer_flags_v2.js
There are multiple ways the popup/pause is triggered, first there is the checking of the variable window._lact which is the timestamp of the last action. Modifying it regularily will prevent some of the trigger, but there are triggers that are called via ajax.
On the polymer file, there is this function
function(k){if(1==k.nextAddress){a.reset();a.youThereData_=b.configData.youThereData;if(a.youThereData_.reason&&"YOU_THERE_TRIGGER_REASON_3"==a.youThereData_.reason&&!jU())return EP("YOU_THERE_EVENT_TYPE_RATE_LIMITED"),k.return();c=parseInt(a.youThereData_.lactThresholdMs,10);return!B("disable_youthere_lact_threshold_check")&&Sn()+1E3*a.youThereData_.promptDelaySec<c?(EP("YOU_THERE_EVENT_TYPE_BELOW_LACT_THRESHOLD",Ko()),k.return()):0>=a.youThereData_.playbackPauseDelayMs?(ZCa(a),k.return()):xa(k,
a.playerProvider_().getPlayerPromise(),2)}d=k.yieldResult;e=d.getCurrentTime();if(!a.youThereData_)return k.return();g=a.youThereData_.promptDelaySec;a.showWarningJob_=Gn(L,function(){return Ka(function(m){a.showWarningJob_=0;return xa(m,$Ca(a),0)})},1E3*Math.max(g-e,0));
ya(k)}
i think that if you replace it with
function(k){}
it will not be triggered. However, i don’t know how to modify on the fly the script, i tried with tampermonkey to intercept the script and put the script content from the external file to an inline script, but it doesn’t work, the code is not executed. Maybe you know how to do that ?
edit: as the script is very big (6mb large), it is very difficult to put breakpoints or modify the script in real time as the browser is struggling a lot or even crashing. I tried the override functionnality in chrome but it make the page load during multiple minutes …
Issue Analytics
- State:
- Created 3 years ago
- Comments:36 (3 by maintainers)
Top GitHub Comments
i published a greasemonkey/tampermonkey script here https://greasyfork.org/fr/scripts/401348-yes-i-m-here-youtube
I never tested on music, the popup on start happened multiple times for me, and it happened a few times that the player wasn’t loaded so I had to add a retry functionality but using timeout or interval doesn’t make a big difference as I’m clearing the interval once the player is loaded. It’s just a preference, but that doesn’t make the code bad. I’m running every second as the popup that display on start was only a few seconds after loading so it was required for me.