question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello, 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:open
  • Created 3 years ago
  • Comments:36 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
momala454commented, Apr 18, 2020

i published a greasemonkey/tampermonkey script here https://greasyfork.org/fr/scripts/401348-yes-i-m-here-youtube

3reactions
momala454commented, Nov 1, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Better Way, Inc.
A Better Way is a San Francisco Bay Area 501(c)(3) nonprofit that provides the highest quality services to children in - or at...
Read more >
Better Way of Miami
Better Way has been providing services for over a quarter century, and has earned the reputation of being one of South Florida's most...
Read more >
A Better Way - We're here to help! - Muncie
A Better Way provides shelter and services for victims of domestic violence and sexual assault, a walk-in Rape Crisis Center, advocacy, ...
Read more >
Better Way Designs – Purchasing hand-made products ...
Better Way Designs offers 3 tangible ways to participate in creating freedom. We call them the 3 B's: Buy, Book and Become. Buying...
Read more >
Betterway Bamboo Toilet Paper
15% of global deforestation is caused by toilet paper demand. We can change that by making bamboo toilet paper the standard. Our premium...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found