lrkmusic-ytpro 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/script.js ADDED
@@ -0,0 +1,2739 @@
1
+ /***** lrkmusic-ytpro *****
2
+ Author: Satya Prakash
3
+ Version: 1.0.0
4
+ */
5
+
6
+
7
+ //DEBUG
8
+ /*var debug=false;
9
+ var Android={
10
+ pipvid:()=>{},
11
+ gohome:()=>{},
12
+ getInfo:()=>{},
13
+ oplink:()=>{},
14
+ downvid:()=>{}
15
+ };
16
+ s1: FoQR9rLpRy8
17
+ s2: PN51tJhZscE
18
+ */
19
+ if(window.eruda == null && localStorage.getItem("devMode") == "true"){
20
+ //ERUDA
21
+ window.location.href=`javascript:(function () { var script = document.createElement('script'); script.src="//youtube.com/ytpro_cdn/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init();} })();`;
22
+ }
23
+ /**/
24
+
25
+ if(!YTProVer){
26
+
27
+ /*Few Stupid Inits*/
28
+ var YTProVer="3.95";
29
+ var ytoldV="";
30
+ var isF=false; //what is this for?
31
+ var isAp=false; // oh it's for bg play
32
+ const originalPause = HTMLMediaElement.prototype.pause; // well long story short , save the original pause function
33
+ window.PIPause = false; // for pausing video when in PIP
34
+ window.isPIP=false;
35
+ window.pauseAllowed = true; // allow pause by default
36
+ var sTime=[];
37
+ var webUrls=["m.youtube.com","music.youtube.com","youtube.com","yout.be","accounts.google.com"];
38
+ var GeminiAT="";
39
+ var GeminiModels={
40
+ "2.0 Flash":'[null,null,null,null,"f299729663a2343f"]', //g2.0 FLASH
41
+ "2.0 Flash Thinking": '[null,null,null,null,"7ca48d02d802f20a"]', //g2.0 flash thinking
42
+ '2.5 Flash':'[1,null,null,null,"71c2d248d3b102ff",null,null,0,[4]]',
43
+ '2.5 Pro':'[1,null,null,null,"4af6c7f5da75d65d",null,null,0,[4]]',
44
+ };
45
+ var YTPROCodecs={
46
+ video:["AV1","VP8","VP9","H264"],
47
+ audio:["Opus","Mp4a"]
48
+ }
49
+
50
+ let touchstartY = 0;
51
+ let touchendY = 0;
52
+ let initialDistance=null;
53
+
54
+ //swipe controls
55
+ var sens=0.005;
56
+ var vol=Android.getVolume();
57
+ var brt = Android.getBrightness()/100;
58
+
59
+ if(localStorage.getItem("saveCInfo") == null || localStorage.getItem("gesC") == null || localStorage.getItem("gesM") == null || localStorage.getItem("bgplay") == null){
60
+ localStorage.setItem("autoSpn","true");
61
+ localStorage.setItem("bgplay","true");
62
+ localStorage.setItem("gesC","true");
63
+ localStorage.setItem("gesM","false");
64
+ localStorage.setItem("fzoom","false");
65
+ localStorage.setItem("saveCInfo","true");
66
+ localStorage.setItem("geminiModel","2.5 Flash");
67
+ localStorage.setItem("prompt","Give me details about this YouTube video Id: {videoId} , a detailed summary of timestamps with facts , resources and reviews of the main content");
68
+ localStorage.setItem("devMode","false");
69
+
70
+ localStorage.setItem("block_60fps","false");
71
+
72
+ YTPROCodecs.video.forEach((x)=>{
73
+ localStorage.setItem(x,"true");
74
+ });
75
+
76
+ YTPROCodecs.audio.forEach((x)=>{
77
+ localStorage.setItem(x,"true");
78
+ });
79
+
80
+ }
81
+ if(localStorage.getItem("fzoom") == "true"){
82
+ document.getElementsByName("viewport")[0].setAttribute("content","");
83
+ }
84
+
85
+ /* Slight zoom-out so top nav and content fit better (smaller, fit look) */
86
+ (function setZoomOut() {
87
+ function apply() {
88
+ try {
89
+ var vp = document.querySelector('meta[name="viewport"]');
90
+ if (vp && vp.getAttribute("content") && vp.getAttribute("content").indexOf("initial-scale=0.9") === -1 && vp.getAttribute("content").indexOf("initial-scale=1") !== -1) {
91
+ vp.setAttribute("content", (vp.getAttribute("content") || "").replace(/initial-scale=1\.0?/g, "initial-scale=0.9").replace(/minimum-scale=1\.0?/g, "minimum-scale=0.85"));
92
+ }
93
+ } catch (e) {}
94
+ }
95
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", apply);
96
+ else apply();
97
+ })();
98
+
99
+ /* Hide YouTube bottom nav (Home, Shorts, You) and remove bottom padding – only content visible */
100
+ (function hideBottomNav() {
101
+ var styleId = "ytpro-hide-bottom-nav";
102
+ var selectors = [
103
+ "ytm-pivot-bar", "ytm-pivot-bar-renderer", "[id='pivot-bar']",
104
+ "ytm-tab-bar", "[class*='pivot-bar']", "[class*='tab-bar']",
105
+ "[class*='bottom-nav']", "ytm-bottom-bar", "ytm-pivot-bar-container",
106
+ "tp-yt-paper-tabs"
107
+ ].join(", ");
108
+ var css = selectors + " { display: none !important; visibility: hidden !important; height: 0 !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; overflow: hidden !important; } ";
109
+ css += "body, ytm-browse, #content, ytm-app { padding-bottom: 0 !important; } ";
110
+ function injectStyle() {
111
+ if (document.getElementById(styleId)) return;
112
+ var s = document.createElement("style");
113
+ s.id = styleId;
114
+ s.textContent = css;
115
+ (document.head || document.documentElement).appendChild(s);
116
+ }
117
+ function hideViaJS() {
118
+ try {
119
+ ["ytm-pivot-bar", "ytm-pivot-bar-renderer", "ytm-tab-bar", "#pivot-bar"].forEach(function(tag) {
120
+ document.querySelectorAll(tag).forEach(function(el) { el.style.cssText = "display:none!important;height:0!important;"; });
121
+ });
122
+ } catch (e) {}
123
+ }
124
+ function run() {
125
+ injectStyle();
126
+ hideViaJS();
127
+ var t = 0, iv = setInterval(function() {
128
+ hideViaJS();
129
+ if (++t >= 6) clearInterval(iv);
130
+ }, 500);
131
+ }
132
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", run);
133
+ else run();
134
+ if (typeof navigation !== "undefined" && navigation.addEventListener) {
135
+ navigation.addEventListener("navigate", function() { setTimeout(run, 300); });
136
+ }
137
+ })();
138
+
139
+ if(window.location.pathname.indexOf("shorts") > -1){
140
+ ytoldV=window.location.pathname;
141
+ }
142
+ else{
143
+ ytoldV=(new URLSearchParams(window.location.search)).get('v') ;
144
+ }
145
+
146
+
147
+ /*Dark and Light Mode*/
148
+ var c="#000";
149
+ var d="#f2f2f2";
150
+ var dc="#fff";
151
+ var isD=false;
152
+ var dislikes="...";
153
+
154
+
155
+ if(document.cookie.indexOf("f6=40000") > -1){
156
+ dc ="#000";c ="#fff";d="rgba(255,255,255,0.1)";
157
+ isD=true;
158
+ }else{
159
+ dc ="#fff";c="#000";d="rgba(0,0,0,0.05)";
160
+ isD=false;
161
+ }
162
+
163
+ var downBtn=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none">
164
+ <path
165
+ d="M16.59 9H15V4a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5H7.41a1 1 0 0 0-.7 1.7l4.59 4.59a1 1 0 0 0 1.42 0l4.59-4.59a1 1 0 0 0-.72-1.7Z"
166
+ stroke="${c}"
167
+ stroke-width="1.8"
168
+ stroke-linecap="round"
169
+ stroke-linejoin="round"
170
+ />
171
+ <rect x="5" y="17.2" width="14" height="1.8" rx="0.9" fill="${c}" />
172
+ </svg>
173
+ `;
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+ function override() {
185
+
186
+ var videoElem = document.createElement('video');
187
+ var origCanPlayType = videoElem.canPlayType.bind(videoElem);
188
+ videoElem.__proto__.canPlayType = makeModifiedTypeChecker(origCanPlayType);
189
+
190
+ var mse = window.MediaSource;
191
+
192
+ if (mse === undefined) return;
193
+ var origIsTypeSupported = mse.isTypeSupported.bind(mse);
194
+ mse.isTypeSupported = makeModifiedTypeChecker(origIsTypeSupported);
195
+ }
196
+
197
+
198
+ function makeModifiedTypeChecker(origChecker) {
199
+
200
+
201
+ return function (type) {
202
+ if (type === undefined) return '';
203
+ var disallowed_types = [];
204
+ if (localStorage['H264'] === 'false') {
205
+ disallowed_types.push('avc');
206
+ }
207
+ if (localStorage['VP8'] === 'false') {
208
+ disallowed_types.push('vp8');
209
+ }
210
+ if (localStorage['VP9'] === 'false') {
211
+ disallowed_types.push('vp9', 'vp09');
212
+ }
213
+ if (localStorage['AV1'] === 'true') {
214
+ disallowed_types.push('av01', 'av99');
215
+ }
216
+ if (localStorage['Opus'] === 'false') {
217
+ disallowed_types.push('opus');
218
+ }
219
+ if (localStorage['Mp4a'] === 'false') {
220
+ disallowed_types.push('mp4a');
221
+ }
222
+
223
+ // If video type is in disallowed_types, say we don't support them
224
+ for (var i = 0; i < disallowed_types.length; i++) {
225
+ if (type.indexOf(disallowed_types[i]) !== -1) return '';
226
+ }
227
+
228
+ if (localStorage['block_60fps'] === 'true') {
229
+ var match = /framerate=(\d+)/.exec(type);
230
+ if (match && match[1] > 30) return '';
231
+ }
232
+
233
+ return origChecker(type);
234
+ };
235
+ }
236
+
237
+ if (window.location.href.indexOf("music.youtube.com") === -1) override();
238
+
239
+
240
+
241
+
242
+
243
+ function insertAfter(referenceNode, newNode) {
244
+ try{
245
+ referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
246
+ }catch{}
247
+ }
248
+
249
+
250
+ /*wait for the element , using observer*/
251
+ async function waitForElement(selector,vid) {
252
+ return new Promise((resolve) => {
253
+ const element = document.querySelector(selector);
254
+ if(element){
255
+ if(vid && element.src != "") return resolve(element);
256
+ if(!vid) return resolve(element);
257
+ }
258
+ const observer = new MutationObserver(() => {
259
+ const el = document.querySelector(selector);
260
+ if (el){
261
+
262
+ if(vid && el.src) resolve(el),observer.disconnect();;
263
+ if(!vid) resolve(el),observer.disconnect();;
264
+ }
265
+ });
266
+ observer.observe(document.body, {
267
+ childList: true,
268
+ subtree: true
269
+ });
270
+ });
271
+ }
272
+
273
+
274
+ /*Add Settings Tab*/
275
+ var addSettingsTab=()=>{
276
+ if(document.getElementById("setDiv") == null){
277
+ var setDiv=document.createElement("div");
278
+ setDiv.setAttribute("style",`
279
+ z-index:9999999999;
280
+ font-size:22px;
281
+ text-align:center;
282
+ line-height:35px;
283
+ pointer-events:auto;
284
+ `);
285
+ setDiv.setAttribute("id","setDiv");
286
+ var svg=document.createElement("ytm-pivot-bar-item-renderer");
287
+ svg.innerHTML=`<svg fill="${ window.location.href.indexOf("watch") < 0 ? c : "#fff" }" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" id="hSett"><path d="M12.844 1h-1.687a2 2 0 00-1.962 1.616 3 3 0 01-3.92 2.263 2 2 0 00-2.38.891l-.842 1.46a2 2 0 00.417 2.507 3 3 0 010 4.525 2 2 0 00-.417 2.507l.843 1.46a2 2 0 002.38.892 3.001 3.001 0 013.918 2.263A2 2 0 0011.157 23h1.686a2 2 0 001.963-1.615 3.002 3.002 0 013.92-2.263 2 2 0 002.38-.892l.842-1.46a2 2 0 00-.418-2.507 3 3 0 010-4.526 2 2 0 00.418-2.508l-.843-1.46a2 2 0 00-2.38-.891 3 3 0 01-3.919-2.263A2 2 0 0012.844 1Zm-1.767 2.347a6 6 0 00.08-.347h1.687a4.98 4.98 0 002.407 3.37 4.98 4.98 0 004.122.4l.843 1.46A4.98 4.98 0 0018.5 12a4.98 4.98 0 001.716 3.77l-.843 1.46a4.98 4.98 0 00-4.123.4A4.979 4.979 0 0012.843 21h-1.686a4.98 4.98 0 00-2.408-3.371 4.999 4.999 0 00-4.12-.399l-.844-1.46A4.979 4.979 0 005.5 12a4.98 4.98 0 00-1.715-3.77l.842-1.459a4.98 4.98 0 004.123-.399 4.981 4.981 0 002.327-3.025ZM16 12a4 4 0 11-7.999 0 4 4 0 018 0Zm-4 2a2 2 0 100-4 2 2 0 000 4Z"></path></svg>
288
+ `;
289
+ setDiv.appendChild(svg);
290
+ insertAfter(document.getElementsByTagName("ytm-home-logo")[0],setDiv)
291
+ if(document.getElementById("hSett") != null){
292
+ document.getElementById("hSett").addEventListener("click",
293
+ function(ev){
294
+ window.location.hash="settings";
295
+ });
296
+ }
297
+ }
298
+
299
+
300
+ };
301
+
302
+
303
+
304
+
305
+ /*Dislikes To Locale, Credits: Return YT Dislikes*/
306
+ function getDislikesInLocale(num){
307
+ var nn=num;
308
+ if (num < 1000){
309
+ nn = num;
310
+ }
311
+ else{
312
+ const int = Math.floor(Math.log10(num) - 2);
313
+ const decimal = int + (int % 3 ? 1 : 0);
314
+ const value = Math.floor(num / 10 ** decimal);
315
+ nn= value * 10 ** decimal;
316
+ }
317
+ let userLocales;
318
+ if (document.documentElement.lang) {
319
+ userLocales = document.documentElement.lang;
320
+ } else if (navigator.language) {
321
+ userLocales = navigator.language;
322
+ } else {
323
+ try {
324
+ userLocales = new URL(
325
+ Array.from(document.querySelectorAll("head > link[rel='search']"))
326
+ ?.find((n) => n?.getAttribute("href")?.includes("?locale="))
327
+ ?.getAttribute("href")
328
+ )?.searchParams?.get("locale");
329
+ } catch {
330
+ userLocales = "en";
331
+ }
332
+ }
333
+ return Intl.NumberFormat(userLocales, {
334
+ notation: "compact",
335
+ compactDisplay: "short",
336
+ }).format(nn);
337
+ }
338
+
339
+
340
+
341
+ /*Auto-play Next Video - YouTube style*/
342
+ function setupAutoPlayNext() {
343
+ try {
344
+ var player = document.getElementsByClassName('video-stream')[0];
345
+ if (player && !player.hasAttribute('data-autoplay-setup')) {
346
+ player.setAttribute('data-autoplay-setup', 'true');
347
+
348
+ player.addEventListener('ended', function() {
349
+ setTimeout(function() {
350
+ try {
351
+ // Try to find and click the next video button
352
+ var nextButton = document.querySelector('ytm-pivot-bar-item-renderer[tab-id="NEXT"]') ||
353
+ document.querySelector('[aria-label*="Next"]') ||
354
+ document.querySelector('button[aria-label*="Next"]') ||
355
+ document.querySelector('.ytp-next-button');
356
+
357
+ if (nextButton) {
358
+ nextButton.click();
359
+ } else {
360
+ // Try to find next video in recommendations
361
+ var nextVideo = document.querySelector('ytm-compact-video-renderer a[href*="/watch"]') ||
362
+ document.querySelector('ytm-video-with-context-renderer a[href*="/watch"]') ||
363
+ document.querySelector('a[href*="/watch"]');
364
+ if (nextVideo && nextVideo.href) {
365
+ window.location.href = nextVideo.href;
366
+ }
367
+ }
368
+ } catch (e) {
369
+ console.log("Auto-play next error:", e);
370
+ }
371
+ }, 500);
372
+ });
373
+ }
374
+ } catch (e) {
375
+ // Silently fail
376
+ }
377
+ }
378
+
379
+ /* Shorts: when user does NOT scroll, auto-scroll to next short when current video ends */
380
+ function setupShortsAutoScroll() {
381
+ if (window.location.pathname.indexOf("shorts") === -1) return;
382
+ try {
383
+ window.__shortsUserDidScroll = false;
384
+ var scrollThreshold = 25;
385
+ function markUserScrolled() { window.__shortsUserDidScroll = true; }
386
+ document.addEventListener("touchmove", function(e) {
387
+ if (e.touches.length && Math.abs(e.touches[0].pageY - (window.__shortsTouchStartY || 0)) > scrollThreshold) markUserScrolled();
388
+ }, { passive: true });
389
+ document.addEventListener("touchstart", function(e) {
390
+ if (e.touches.length) window.__shortsTouchStartY = e.touches[0].pageY;
391
+ }, { passive: true });
392
+ document.addEventListener("wheel", function() { markUserScrolled(); }, { passive: true });
393
+ var player = document.getElementsByClassName("video-stream")[0];
394
+ if (!player || player.hasAttribute("data-shorts-autoscroll-setup")) return;
395
+ player.setAttribute("data-shorts-autoscroll-setup", "true");
396
+ player.loop = false;
397
+ player.addEventListener("ended", function() {
398
+ if (window.__shortsUserDidScroll) {
399
+ window.__shortsUserDidScroll = false;
400
+ return;
401
+ }
402
+ setTimeout(function() {
403
+ try {
404
+ var current = player.closest("ytm-reel-item-renderer") || player.closest("[class*=\"reel\"]") || player.parentElement;
405
+ var next = current && (current.nextElementSibling || current.parentElement && current.parentElement.nextElementSibling);
406
+ if (next && next.scrollIntoView) {
407
+ next.scrollIntoView({ behavior: "smooth", block: "start" });
408
+ } else {
409
+ var step = window.innerHeight || 400;
410
+ var container = document.getElementById("shorts-container") || document.querySelector("[class*=\"reel\"][class*=\"container\"]") || document.querySelector("ytm-reel-shelf-renderer");
411
+ if (container && typeof container.scrollTop !== "undefined") {
412
+ container.scrollTop = (container.scrollTop || 0) + step;
413
+ } else {
414
+ window.scrollBy({ top: step, behavior: "smooth" });
415
+ }
416
+ var el = document.body || document.documentElement;
417
+ var y = window.innerHeight / 2;
418
+ ["touchstart", "touchmove", "touchend"].forEach(function(ev, i) {
419
+ var t = new TouchEvent(ev, { bubbles: true, cancelable: true, touches: i === 2 ? [] : [{ clientX: 100, clientY: y + (i === 0 ? 0 : step), identifier: 1 }], changedTouches: [{ clientX: 100, clientY: i === 0 ? y : y - step, identifier: 1 }] });
420
+ el.dispatchEvent(t);
421
+ });
422
+ }
423
+ } catch (e) {}
424
+ window.__shortsUserDidScroll = false;
425
+ }, 400);
426
+ });
427
+ } catch (e) {}
428
+ }
429
+
430
+ /*Skips the bad part :)*/
431
+ async function skipSponsor(){
432
+ var sDiv=document.createElement("div");
433
+ sDiv.setAttribute("style",`height:3px;pointer-events:none;width:100%;position:absolute;z-index:99;`)
434
+ sDiv.setAttribute("id","sDiv");
435
+ var player = document.getElementsByClassName("video-stream")[0];
436
+ var dur=player.duration;
437
+
438
+ if(isNaN(dur)) return;
439
+
440
+ for(var x in sTime){
441
+ var s1=document.createElement("div");
442
+ var s2=sTime[x];
443
+ s1.setAttribute("style",`height:3px;width:${(100/dur) * (s2[1]-s2[0])}%;background:#0f8;position:absolute;z-index:9;left:${(100/dur) * s2[0]}%;`)
444
+ sDiv.appendChild(s1);
445
+ }
446
+
447
+
448
+
449
+
450
+ var e=await waitForElement("yt-progress-bar",false);
451
+
452
+
453
+ if(document.getElementById("sDiv") == null){
454
+ if(document.getElementsByClassName('ytPlayerProgressBarHost')[0] != null){
455
+ document.getElementsByClassName('ytPlayerProgressBarHost')[0].appendChild(sDiv);
456
+ }else{
457
+ try{document.getElementsByClassName('ytProgressBarLineProgressBarLine')[0].appendChild(sDiv);}catch{}
458
+ }
459
+ }
460
+
461
+
462
+
463
+
464
+ }
465
+
466
+
467
+
468
+
469
+
470
+ /*Fetch The Dislikes*/
471
+ async function fDislikes(url){
472
+ var Url=new URL(url);
473
+ var vID="";
474
+ if(Url.pathname.indexOf("shorts") > -1){
475
+ vID=Url.pathname.substr(8,Url.pathname.length);
476
+ }
477
+ else if(Url.pathname.indexOf("watch") > -1){
478
+ vID=Url.searchParams.get("v");
479
+ }
480
+
481
+
482
+ fetch("https://returnyoutubedislikeapi.com/votes?videoId="+vID)
483
+ .then(response => {
484
+ return response.json();
485
+ }).then(jsonObject => {
486
+ if('dislikes' in jsonObject){
487
+ dislikes=getDislikesInLocale(parseInt(jsonObject.dislikes));
488
+ }
489
+ }).catch(error => {});
490
+
491
+ }
492
+
493
+
494
+
495
+ /*Check For Sponsorships*/
496
+ async function checkSponsors(Url){
497
+
498
+
499
+ if(Url.indexOf("watch") > -1){
500
+
501
+ sTime=[];
502
+
503
+ await fetch("https://sponsor.ajay.app/api/skipSegments?videoID="+new URL(Url).searchParams.get("v"))
504
+ .then(response => {
505
+ return response.json();
506
+ }).then(jsonObject => {
507
+ for(var x in jsonObject){
508
+ var time=jsonObject[x].segment;
509
+ sTime.push(time);
510
+ }
511
+ }).catch(error => {});
512
+
513
+
514
+
515
+ /*Skip the Sponsor*/
516
+ var player = await waitForElement(".video-stream",true);
517
+
518
+
519
+ player.ontimeupdate=()=>{
520
+ skipSponsor();
521
+ var cur=player.currentTime;
522
+ for(var x in sTime){
523
+ var s2=sTime[x];
524
+ if(Math.floor(cur) == Math.floor(s2[0])){
525
+ if(localStorage.getItem("autoSpn") == "true"){
526
+ player.currentTime=s2[1];
527
+ addSkipper(s2[0]);
528
+ }
529
+ }
530
+ }
531
+ };
532
+
533
+
534
+
535
+
536
+
537
+ }
538
+
539
+ }
540
+
541
+ /*Add Skip Sponsor Element*/
542
+ function addSkipper(sT){
543
+ var sSDiv=document.createElement("div");
544
+ sSDiv.setAttribute("style",`
545
+ height:50px;${(screen.width > screen.height) ? "width:50%;" : "width:80%;"}overflow:auto;background:rgba(130,130,130,.3);
546
+ backdrop-filter:blur(6px);
547
+ position:absolute;bottom:40px;
548
+ line-height:50px;
549
+ left:calc(15% / 2 );padding-left:10px;padding-right:10px;
550
+ z-index:99999999999999;text-align:center;border-radius:25px;
551
+ color:white;text-align:center;
552
+ `);
553
+ sSDiv.innerHTML=`<span style="height:30px;line-height:30px;margin-top:10px;display:block;font-family:monospace;font-size:16px;float:left;">Skipped Sponsor</span>
554
+ <span style="height:30px;line-height:44px;float:right;padding-right:30px;margin-top:10px;display:block;padding-left:30px;border-left:1px solid white;">
555
+ <svg onclick="this.parentElement.parentElement.remove();document.getElementsByClassName('video-stream')[0].currentTime=${sT+1};" xmlns="http://www.w3.org/2000/svg" width="23" height="23" style="margin-top:0px;" fill="currentColor" viewBox="0 0 16 16">
556
+ <path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z"/>
557
+ <path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"/>
558
+ </svg>
559
+ <svg onclick="this.parentElement.parentElement.remove();" xmlns="http://www.w3.org/2000/svg" width="20" height="20" style="margin-left:30px;" fill="#f24" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
560
+ <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"/>
561
+ </svg>
562
+ </span>`;
563
+ document.getElementById("player-control-container").appendChild(sSDiv);
564
+ setTimeout(()=>{sSDiv.remove();},5000);
565
+ }
566
+
567
+
568
+ fDislikes(window.location.href);
569
+ checkSponsors(window.location.href);
570
+
571
+
572
+ if((window.location.pathname.indexOf("watch") > -1) || (window.location.pathname.indexOf("shorts") > -1)){
573
+ var unV=setInterval(() => {
574
+
575
+
576
+ /*Unmute The Video*/
577
+
578
+ document.getElementsByClassName('video-stream')[0].muted=false;
579
+
580
+ if(!document.getElementsByClassName('video-stream')[0].muted){
581
+ clearInterval(unV);
582
+
583
+ }
584
+
585
+ }, 5);
586
+
587
+ // Setup auto-play next when video ends
588
+ setTimeout(function() {
589
+ setupAutoPlayNext();
590
+ setupShortsAutoScroll();
591
+ }, 1000);
592
+
593
+ }
594
+
595
+ /*Funtion to set Element Styles*/
596
+ function sty(e,v){
597
+ var s={
598
+ display:"flex",
599
+ alignItems:"center",
600
+ justifyContent:"center",
601
+ fontWeight:"550",
602
+ height:"65%",
603
+ minWidth:"80px",
604
+ width:"auto",
605
+ borderRadius:"20px",
606
+ background:d,
607
+ fontSize:"12px",
608
+ marginRight:"5px",
609
+ textAlign:"center"
610
+ };
611
+ for(x in s){
612
+ e.style[x]=s[x];
613
+ }
614
+ }
615
+
616
+
617
+ function getGeminiModels(){
618
+ var t="";
619
+
620
+ for(var x in GeminiModels){
621
+
622
+
623
+ t+=`<br>
624
+ <button onclick="localStorage.removeItem('geminiChatInfo');localStorage.setItem('geminiModel','${x}');this.parentElement.style.display='none';" ${(x == localStorage.getItem('geminiModel')) ? `style="background:${c};color:${dc};"` : "" } >${x}
625
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${c}" viewBox="0 0 16 16">
626
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
627
+ </svg>
628
+ </button>`;
629
+ }
630
+
631
+ return t;
632
+
633
+ }
634
+
635
+
636
+ /*Get Codecs*/
637
+ function getYTPROCodecs(){
638
+ var t=`<p style="text-align:center;font-size:14px;">This feature is experimental , this may break YTPro if not configured correctly. By default all the codecs are enabled , tap on the buttons below to switch them.</p><br> <vc style="font-size:14px;">Video Codecs</vc><br>`;
639
+
640
+ for(var y in YTPROCodecs.video){
641
+
642
+ var x=YTPROCodecs.video[y];
643
+
644
+ t+=`<button onclick="setRemoveCodec('${x}',this)" ${("true" == localStorage.getItem(x)) ? `style="background:${c};color:${dc};"` : "" } >${x}
645
+ <svg ${("true" != localStorage.getItem(x)) ? `style="display:none"` : "" } xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${dc}" viewBox="0 0 16 16">
646
+ <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>
647
+ </svg>
648
+ </button>`;
649
+ }
650
+
651
+ t+=`<br><br><vc style="font-size:14px">Audio Codecs</vc><br>`
652
+ for(var y in YTPROCodecs.audio){
653
+
654
+ var x=YTPROCodecs.audio[y];
655
+
656
+ t+=`<button onclick="setRemoveCodec('${x}',this)" ${("true" == localStorage.getItem(x)) ? `style="background:${c};color:${dc};"` : "" } >${x}
657
+ <svg ${("true" != localStorage.getItem(x)) ? `style="display:none"` : "" } xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${dc}" viewBox="0 0 16 16">
658
+ <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>
659
+ </svg>
660
+ </button>`;
661
+ }
662
+
663
+ t+=`<br><br>
664
+ <div>Block 60FPS <span onclick="sttCnf(this,'block_60fps');" style="${sttCnf(0,0,"block_60fps")}" ><b style="${sttCnf(0,1,"block_60fps")}" ></b></span></div> `;
665
+
666
+ t+=`<br><br><button onclick="this.parentElement.style.display='none';" style="margin-top:10px;width:25%;float:right;text-align:center;background:${c};color:${dc};" >Done</button>`;
667
+
668
+
669
+ return t;
670
+
671
+ }
672
+
673
+
674
+ function setRemoveCodec(x,y){
675
+
676
+
677
+ if(localStorage[x] == "true"){
678
+ localStorage.setItem(x,"false");
679
+ y.style.background=isD ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)";
680
+ y.style.color=c;
681
+ y.children[0].style.display="none";
682
+ }else{
683
+ localStorage.setItem(x,"true");
684
+ y.style.background=c;
685
+ y.style.color=dc;
686
+ y.children[0].style.display="block";
687
+ }
688
+
689
+
690
+
691
+
692
+ }
693
+
694
+
695
+ /*The settings tab*/
696
+ async function ytproSettings(){
697
+ var ytpSet=document.createElement("div");
698
+ var ytpSetI=document.createElement("div");
699
+ ytpSet.setAttribute("id","settingsprodiv");
700
+ ytpSetI.setAttribute("id","ssprodivI");
701
+ ytpSet.setAttribute("style",`
702
+ height:100%;width:100%;position:fixed;top:0;left:0;
703
+ display:flex;justify-content:center;
704
+ background:rgba(0,0,0,0.7);
705
+ z-index:9999;
706
+ `);
707
+ ytpSet.addEventListener("click",
708
+ function(ev){
709
+
710
+ if(!(ev.target == ytpSetI || ytpSetI.contains(ev.target))){
711
+
712
+ history.back();
713
+ }
714
+ });
715
+
716
+ ytpSetI.setAttribute("style",`
717
+ height:65%;width:calc(95% - 20px);overflow:auto;
718
+ background:${isD ? "#212121" : "#f1f1f1"};
719
+ position:fixed;
720
+ bottom:20px;
721
+ z-index:99999999999999;padding:10px;text-align:center;border-radius:25px;color:${c};text-align:center;
722
+ color:${isD ? "#ccc" : "#444"};`);
723
+
724
+ ytpSetI.innerHTML=`<style>
725
+ @import url('https://fonts.googleapis.com/css2?family=Delius&display=swap');
726
+ #settingsprodiv a{text-decoration:underline;} #settingsprodiv li{list-style:none; display:flex;align-items:center;justify-content:center;color:#fff;border-radius:25px;padding:10px;background:#000;margin:5px;}
727
+ #ssprodivI div{
728
+ height:10px;
729
+ width:calc(100% - 20px);
730
+ padding:10px;
731
+ font-size:1.45rem;
732
+ text-align:left;
733
+ display:flex;
734
+ align-items:center;
735
+ position:relative;
736
+ margin-top:3px;
737
+ }
738
+ #ssprodivI div span{
739
+ display:block;
740
+ height:23px;
741
+ width:40px;
742
+ border-radius:40px;
743
+ right:10px;
744
+ position:absolute;
745
+ background:#151515;
746
+ }
747
+ #ssprodivI div span b{
748
+ display:block;
749
+ height:19px;
750
+ width:19px;
751
+ position:absolute;
752
+ right:2px;
753
+ top:2px;
754
+ border-radius:50px;
755
+ background:#fff;
756
+ }
757
+ #ssprodivI div input::placeholder{color:${ isD ? "white" : "#000"};}
758
+ #ssprodivI div input,#ssprodivI div button{
759
+ height:35px;
760
+ background:${isD ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)"};
761
+ width:100%;
762
+ border:0;
763
+ border-radius:20px;
764
+ padding:10px;
765
+ font-size:1.25rem;
766
+ }
767
+ #ssprodivI button{
768
+ background:transparent;
769
+ font-size:1.45rem;
770
+ width:calc(100% - 20px);
771
+ height:40px;
772
+ color:${isD ? "#ccc" : "#444"};
773
+ margin-top:3px;
774
+ text-align:left;
775
+ }
776
+ #ssprodivI button svg{
777
+ float:right;
778
+ }
779
+ #ssprodivI .credit{
780
+ font-family: "Delius", cursive;
781
+ font-style: normal;
782
+ display:flex;
783
+ justify-content:center;
784
+ align-items:center;
785
+ text-align:center;
786
+ font-size:1.55rem;
787
+ font-weight:bolder;
788
+ color:${isD ? "#fff" : "#000"};
789
+ position:fixed;
790
+ bottom:20px;
791
+ width:calc(95% - 20px);
792
+ left:calc(2.5% + 0px);
793
+ background:${d};
794
+ border-radius:0 0 25px 25px;
795
+ backdrop-filter:blur(10px);
796
+ height:15px;
797
+ }
798
+ #ssprodivI .geminiModels,#ssprodivI .disableCodecs,#ssprodivI .geminiPrompt{
799
+ height:auto;
800
+ min-height:100px;
801
+ padding-bottom:12px;
802
+ background:${isD ? "#212121" : "#f1f1f1"};
803
+ position:fixed;
804
+ display:block;
805
+ width:calc(95% - 20px);
806
+ left:calc(2.5% + 0px);
807
+ bottom:20px;
808
+ z-index:999999;
809
+ box-shadow:0px 0px 5px black;
810
+ border-radius:25px;
811
+ display:none;
812
+ }
813
+ #ssprodivI .geminiModels:before,#ssprodivI .disableCodecs:before,#ssprodivI .geminiPrompt:before{
814
+ height:100%;
815
+ width:100%;
816
+ background:rgba(0,0,0,.6);
817
+ position:fixed;
818
+ top:0;
819
+ left:0;
820
+ z-index:-999;
821
+ }
822
+ #ssprodivI .geminiPrompt textarea{
823
+ height:300px;
824
+ width:95%;
825
+ border-radius:20px;
826
+ padding:15px;
827
+ background:${d};
828
+ }
829
+ #ssprodivI .disableCodecs{
830
+ column:50%;
831
+ }
832
+ #ssprodivI .disableCodecs button{
833
+ width:48%;
834
+ column:50%;
835
+ margin-right:2%;
836
+ color:${c};
837
+ }
838
+ </style>`;
839
+ ytpSetI.innerHTML+=`<br><b style='font-size:18px' >YT PRO Settings</b>
840
+ <span style="font-size:10px">v${YTProVer}</span>
841
+ <br><br>
842
+ <div><input type="url" placeholder="Enter Youtube URL" onkeyup="searchUrl(this,event)"></div>
843
+ <br>
844
+ <button onclick="window.location.hash='#hearts';">Liked Videos
845
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
846
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
847
+ </svg>
848
+ </button>
849
+ <br>
850
+ <button onclick="checkUpdates();">Check for Updates
851
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
852
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
853
+ </svg>
854
+ </button>
855
+ <br>
856
+ <button onclick="Android.openDownloads();">Downloaded Videos
857
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
858
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
859
+ </svg>
860
+ </button>
861
+ <br>
862
+ <div>Autoskip Sponsors <span onclick="sttCnf(this,'autoSpn');" style="${sttCnf(0,0,"autoSpn")}" ><b style="${sttCnf(0,1,"autoSpn")}"></b></span></div>
863
+ <br>
864
+ <div>Gesture Controls <span onclick="sttCnf(this,'gesC');" style="${sttCnf(0,0,"gesC")}" ><b style="${sttCnf(0,1,"gesC")}"></b></span></div>
865
+ <br>
866
+ <div>Miniplayer Gesture <span onclick="sttCnf(this,'gesM');" style="${sttCnf(0,0,"gesM")}" ><b style="${sttCnf(0,1,"gesM")}"></b></span></div>
867
+ <br>
868
+ <div>Force Zoom <span onclick="sttCnf(this,'fzoom');" style="${sttCnf(0,0,"fzoom")}" ><b style="${sttCnf(0,1,"fzoom")}" ></b></span></div>
869
+ <br>
870
+ <div>Background Play <span onclick="sttCnf(this,'bgplay');" style="${sttCnf(0,0,"bgplay")}" ><b style="${sttCnf(0,1,"bgplay")}" ></b></span></div>
871
+ <br>
872
+ <div>Hide Shorts <span onclick="sttCnf(this,'shorts');" style="${sttCnf(0,0,"shorts")}" ><b style="${sttCnf(0,1,"shorts")}" ></b></span></div>
873
+ <br>
874
+ <div>Use single Gemini chat <span onclick="sttCnf(this,'saveCInfo');" style="${sttCnf(0,0,"saveCInfo")}" ><b style="${sttCnf(0,1,"saveCInfo")}"></b></span></div>
875
+ <br>
876
+ <button onclick="document.getElementsByClassName('geminiModels')[0].style.display='block';document.getElementsByClassName('geminiModels')[0].innerHTML=getGeminiModels();">Select Gemini Model
877
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
878
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
879
+ </svg>
880
+ </button>
881
+ <br>
882
+ <button onclick="document.getElementsByClassName('geminiPrompt')[0].style.display='block';">Edit Gemini Prompt
883
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
884
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
885
+ </svg>
886
+ </button>
887
+ <br>
888
+ <button onclick="document.getElementsByClassName('disableCodecs')[0].style.display='block';document.getElementsByClassName('disableCodecs')[0].innerHTML=getYTPROCodecs();">Disable Codecs
889
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
890
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
891
+ </svg>
892
+ </button>
893
+ <br>
894
+ <button onclick="Android.oplink('https://www.npmjs.com/package/lrkmusic-ytpro')">Report Bugs
895
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
896
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
897
+ </svg>
898
+ </button>
899
+ <br>
900
+ <button style="font-weight:bolder;" onclick="Android.oplink('https://www.npmjs.com/package/lrkmusic-ytpro');">Package Info
901
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="${isD ? "#ccc" : "#444"}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
902
+ <path d="M5 2l6 6-6 6"/>
903
+ </svg>
904
+
905
+ </button>
906
+ <br>
907
+ <div>Developer Mode <span onclick="sttCnf(this,'devMode');" style="${sttCnf(0,0,"devMode")}" ><b style="${sttCnf(0,1,"devMode")}"></b></span></div>
908
+ <br><br>
909
+ <div class="geminiModels">
910
+
911
+ </div>
912
+
913
+
914
+ <div class="geminiPrompt" style="text-align:center;">
915
+
916
+ <textarea>
917
+ ${localStorage.getItem("prompt")}
918
+ </textarea>
919
+
920
+ <button onclick="localStorage.setItem('prompt',this.previousElementSibling.value);this.parentElement.style.display='none';" style="margin-top:10px;width:25%;float:right;text-align:center;background:${c};color:${dc};" >Save</button>
921
+ <br><br>
922
+ </div>
923
+
924
+
925
+ <div class="disableCodecs">
926
+
927
+ </div>
928
+
929
+
930
+ <div class="credit" >
931
+ <z style="margin-right:6px">Made with </z>
932
+
933
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="#fff" viewBox="-1 -1 18 18">
934
+ <path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314"
935
+ stroke="black" ${ !isD ? "stroke-width='1'" : "" } stroke-linejoin="round" stroke-linecap="round"/>
936
+ </svg>
937
+
938
+
939
+
940
+ <z style="margin-left:6px">by Satya Prakash</z>
941
+ </div>
942
+ `;
943
+
944
+
945
+
946
+ document.body.appendChild(ytpSet);
947
+ ytpSet.appendChild(ytpSetI);
948
+
949
+
950
+
951
+ }
952
+
953
+
954
+
955
+ function searchUrl(x,e){
956
+ if(e.keyCode === 13 || e === "Enter"){
957
+ //window.location.href=x.value;
958
+ var url="",id="";
959
+ var u=x.value;
960
+ try{
961
+ url=new URL(u);
962
+ }catch{
963
+ Android.showToast("Enter a valid URL");
964
+ return;
965
+ }
966
+ if((url.hostname.indexOf("youtube.com") > -1) || (url.hostname.indexOf("youtu.be") > -1) ){
967
+ if(url.pathname.indexOf("shorts") > -1){
968
+ id=url.pathname.substr(8,url.pathname.length);
969
+ }
970
+ else if(url.pathname.indexOf("watch") > -1){
971
+ id=url.searchParams.get("v");
972
+ }else if(url.hostname.indexOf("youtu.be") > -1){
973
+ id=id=url.pathname.substr(1,url.pathname.length);
974
+ }
975
+ }
976
+
977
+ var a=document.createElement("a");
978
+ a.href=url;
979
+ document.body.appendChild(a);
980
+ try{document.getElementById("settingsprodiv").remove();}catch{}
981
+ a.click();
982
+
983
+ }
984
+ }
985
+
986
+ function checkUpdates(){
987
+ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer) ){
988
+ updateModel();
989
+ }else{
990
+ Android.showToast("Your app is up to date");
991
+ }
992
+
993
+ fetch('https://youtube.com/ytpro_cdn/npm/lrkmusic-ytpro', {cache: 'reload'});
994
+ fetch('https://youtube.com/ytpro_cdn/npm/lrkmusic-ytpro/bgplay.js', {cache: 'reload'});
995
+ fetch('https://youtube.com/ytpro_cdn/npm/lrkmusic-ytpro/innertube.js', {cache: 'reload'});
996
+ }
997
+
998
+
999
+ /*Set Configration*/
1000
+ function sttCnf(x,z,y){
1001
+
1002
+ /*Way too complex to understand*/
1003
+ if(isD){
1004
+ var s=["#000","#717171","#fff"];
1005
+ }else{
1006
+ var s=["#fff","#909090","#151515"];
1007
+ }
1008
+
1009
+
1010
+
1011
+ if(typeof y == "string"){
1012
+
1013
+ if(localStorage.getItem(y) != "true"){
1014
+ if(z == 1){
1015
+ return `background:${s[0]};left:2px;`;
1016
+ }else{
1017
+ return `background:${s[1]};`;
1018
+ }
1019
+ }else{
1020
+ if(z == 1){
1021
+ return `background:${s[0]};`;
1022
+ }else{
1023
+ return `background:${s[2]};`;
1024
+ }
1025
+ }
1026
+ }
1027
+ if(localStorage.getItem(z) == "true"){
1028
+ localStorage.setItem(z,"false");
1029
+ x.style.background=s[1];
1030
+ x.children[0].style.left="2px";
1031
+ x.children[0].style.background=s[0];
1032
+ }
1033
+ else{
1034
+ localStorage.setItem(z,"true");
1035
+ x.style.background=s[2];
1036
+ x.children[0].style.left="auto";
1037
+ x.children[0].style.right="2px";
1038
+ x.children[0].style.background=s[0];
1039
+ }
1040
+
1041
+ if(localStorage.getItem("fzoom") == "false"){
1042
+ document.getElementsByName("viewport")[0].setAttribute("content","width=device-width, initial-scale=0.9, minimum-scale=0.85, maximum-scale=1.0, user-scalable=yes, viewport-fit=cover");
1043
+ }else{
1044
+ var vc = document.getElementsByName("viewport")[0].getAttribute("content") || "";
1045
+ if (vc.indexOf("viewport-fit=cover") === -1) {
1046
+ vc = vc.trim().replace(/,\s*$/, "");
1047
+ document.getElementsByName("viewport")[0].setAttribute("content", vc ? vc + ", viewport-fit=cover" : "viewport-fit=cover");
1048
+ }
1049
+ }
1050
+
1051
+
1052
+
1053
+ if(localStorage.getItem("bgplay") == "true"){
1054
+ Android.setBgPlay(true);
1055
+ }else{
1056
+ Android.setBgPlay(false);
1057
+ }
1058
+
1059
+
1060
+ if(localStorage.getItem("gesC") != "true"){
1061
+ try{
1062
+ document.getElementById("brtS").remove();
1063
+ document.getElementById("volS").remove();
1064
+ }catch{}
1065
+
1066
+ }
1067
+
1068
+ if(localStorage.getItem("devMode") == "false"){
1069
+ try{eruda.destroy();}catch{}
1070
+ }else{
1071
+ window.location.href=`javascript:(function () { var script = document.createElement('script'); script.src="//youtube.com/ytpro_cdn/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init();} })();`;
1072
+ }
1073
+
1074
+
1075
+
1076
+ }
1077
+
1078
+
1079
+
1080
+
1081
+ /*Format File Size*/
1082
+ function formatFileSize(x){
1083
+ var s=parseInt(x);
1084
+ let ss = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
1085
+ for (var i=0; s > 1024; i++) s /= 1024;
1086
+ return ` | ${s.toFixed(1)} ${ss[i]}`;
1087
+ }
1088
+
1089
+ /*Video Downloader*/
1090
+ async function ytproDownVid(){
1091
+ var ytproDown=document.createElement("div");
1092
+ var ytproDownDiv=document.createElement("div");
1093
+ ytproDownDiv.setAttribute("id","downytprodiv");
1094
+ ytproDown.setAttribute("id","outerdownytprodiv");
1095
+ ytproDown.setAttribute("style",`
1096
+ height:100%;width:100%;position:fixed;top:0;left:0;
1097
+ display:flex;justify-content:center;
1098
+ background:rgba(0,0,0,0.4);
1099
+ z-index:99999999999999;
1100
+ `);
1101
+ ytproDown.addEventListener("click",
1102
+ function(ev){
1103
+ if(ev.target != ytproDownDiv && !(ytproDownDiv.contains(ev.target)) ){
1104
+ history.back();
1105
+ }
1106
+ });
1107
+
1108
+ ytproDownDiv.setAttribute("style",`
1109
+ height:50%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"};
1110
+ position:absolute;bottom:20px;
1111
+ z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;text-align:center;
1112
+ `);
1113
+
1114
+ document.body.appendChild(ytproDown);
1115
+ ytproDown.appendChild(ytproDownDiv);
1116
+
1117
+ var id="";
1118
+
1119
+ if(window.location.pathname.indexOf("shorts") > -1){
1120
+ id=window.location.pathname.substr(8,window.location.pathname.length);
1121
+ }
1122
+ else{
1123
+ id=new URLSearchParams(window.location.search).get("v");
1124
+ }
1125
+
1126
+ ytproDownDiv.innerHTML="Loading...";
1127
+
1128
+ window.getDownloadStreams();
1129
+
1130
+ }
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+ function showHideAdaptives(){
1137
+ var z=document.querySelectorAll(".adpFormats");
1138
+ z.forEach((x)=>{
1139
+ if(x.style.display=="none"){
1140
+ x.style.display="flex";
1141
+ }else{
1142
+ x.style.display="none";
1143
+ }
1144
+
1145
+ });
1146
+
1147
+ }
1148
+
1149
+ /*Add the meme type and extensions lol*/
1150
+ function downCap(x,t){
1151
+ Android.downvid(t,x,"plain/text");
1152
+ }
1153
+
1154
+ /*Send to Download Manager*/
1155
+ function YTDownVid(o,ex){
1156
+ var mtype="";
1157
+ if(ex ==".png"){
1158
+ mtype="image/png";
1159
+ }else if(ex ==".mp4"){
1160
+ mtype="video/mp4";
1161
+ }
1162
+ else if(ex ==".mp3"){
1163
+ mtype="audio/mp3";
1164
+ }
1165
+
1166
+ //console.log(o.getAttribute("data-ytprourl"))
1167
+
1168
+ Android.downvid((o.getAttribute("data-ytprotit")+ex),o.getAttribute("data-ytprourl"),mtype);
1169
+ }
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+ var stopProp = false;
1179
+ var zoomIn=false;
1180
+ var scale=1;
1181
+
1182
+
1183
+ /*Checks the Direction of the Swipe*/
1184
+ function checkDirection(e) {
1185
+ if ((touchendY > touchstartY) && (touchendY - touchstartY > 20)) {
1186
+ minimize(true);
1187
+ }else if ((touchendY < touchstartY) && (touchstartY - touchendY > 20)) {
1188
+ minimize(false);
1189
+ //console.log((touchstartY - touchendY ))
1190
+ }
1191
+ }
1192
+
1193
+ /*for zoom in and out*/
1194
+ function getDistance(touches) {
1195
+ const [a, b] = touches;
1196
+ return Math.hypot(b.pageX - a.pageX, b.pageY - a.pageY);
1197
+ }
1198
+
1199
+
1200
+
1201
+ /*touch start*/
1202
+ document.body.addEventListener('touchstart', e => {
1203
+ touchstartY = e.changedTouches[0].screenY;
1204
+ if (e.touches.length === 2) {
1205
+ initialDistance = getDistance(e.touches);
1206
+ }
1207
+ }, { capture: true });
1208
+
1209
+
1210
+
1211
+
1212
+ /*touch move*/
1213
+ document.body.addEventListener('touchmove', (e) => {
1214
+
1215
+
1216
+ if(stopProp){
1217
+ e.stopPropagation();
1218
+ }
1219
+
1220
+ if (e.touches.length === 2 && initialDistance !== null) {
1221
+ const currentDistance = getDistance(e.touches);
1222
+ const z = currentDistance / initialDistance;
1223
+
1224
+ stopProp=true;
1225
+
1226
+
1227
+ if((e.target.className.toString().includes("video-stream") || e.target.className.toString().includes("player-controls-background")) && document.fullscreenElement){
1228
+
1229
+ if (z > 1.05) {
1230
+ var Vv=document.getElementsByClassName('video-stream')[0];
1231
+ zoomIn=true;
1232
+ scale=Math.max((screen.height / Vv.offsetHeight) , (screen.width / Vv.offsetWidth));
1233
+ addMaxButton();
1234
+ } else if (z < 0.95) {
1235
+ zoomIn=false;
1236
+ scale=1;
1237
+ addMaxButton();
1238
+ }
1239
+ }
1240
+
1241
+
1242
+
1243
+ }
1244
+ },{capture:true});
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+ /*touch end*/
1252
+ document.body.addEventListener('touchend', e => {
1253
+
1254
+
1255
+ touchendY = e.changedTouches[0].screenY;
1256
+
1257
+ if((e.target.className.toString().includes("video-stream") || e.target.className.toString().includes("player-controls-background")) && !document.fullscreenElement && localStorage.getItem("gesM") == "true"){
1258
+ checkDirection();
1259
+ }
1260
+
1261
+ if (e.touches.length < 2) {
1262
+ initialDistance = null; // reset
1263
+
1264
+ setTimeout(()=>{
1265
+ stopProp=false;
1266
+ },500)
1267
+
1268
+ }
1269
+
1270
+ }, { capture: true });
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+ navigation.addEventListener("navigate", e => {
1277
+ if(e.destination.url.indexOf("watch") > -1 || e.destination.url.indexOf("shorts") > -1){
1278
+ dislikes="...";
1279
+ fDislikes(e.destination.url);
1280
+ checkSponsors(e.destination.url);
1281
+ }
1282
+ });
1283
+
1284
+
1285
+ /*minimize function to mini the video*/
1286
+ function minimize(yes){
1287
+
1288
+
1289
+ const createIframe=()=>{
1290
+
1291
+ var iframe=document.createElement("iframe");
1292
+ iframe.setAttribute("id",`miniIframe`);
1293
+ iframe.setAttribute("style",`
1294
+ height:99.999%;width:100%;
1295
+ background:${c};
1296
+ top:0px;
1297
+ line-height:50px;
1298
+ position:fixed;
1299
+ left:0;
1300
+ z-index:999;
1301
+ border:0;
1302
+ `);
1303
+
1304
+
1305
+ iframe.src="https://m.youtube.com/";
1306
+ document.body.appendChild(iframe);
1307
+
1308
+
1309
+ var iwindow = iframe.contentWindow || iframe.contentDocument.defaultView;
1310
+ var doc = iwindow.document;
1311
+
1312
+ if (doc.readyState == 'complete' ) {
1313
+ if (iwindow.trustedTypes && iwindow.trustedTypes.createPolicy && !iwindow.trustedTypes.defaultPolicy) {
1314
+ iwindow.trustedTypes.createPolicy('default', {createHTML: (string) => string,createScriptURL: string => string, createScript: string => string, });
1315
+ }
1316
+ }
1317
+
1318
+ iwindow.navigation.addEventListener("navigate", e => {
1319
+ if(e.destination.url.indexOf("youtube.com") > -1){
1320
+ if(e.destination.url.indexOf("/watch") > -1 || e.destination.url.indexOf("/shorts") > -1){
1321
+ window.location.href=e.destination.url;
1322
+ }
1323
+ var script = doc.createElement("script");
1324
+ var scriptSource=`window.addEventListener('DOMContentLoaded', function() {
1325
+ var script2 = document.createElement('script');
1326
+ script2.src="//youtube.com/ytpro_cdn/npm/lrkmusic-ytpro";
1327
+ document.body.appendChild(script2);
1328
+ });
1329
+ `;
1330
+ }
1331
+ else{
1332
+ window.location.href=e.destination.url;
1333
+ }
1334
+
1335
+
1336
+ });
1337
+
1338
+ var script = doc.createElement("script");
1339
+ var scriptSource=`window.addEventListener('DOMContentLoaded', function() {
1340
+ var script2 = document.createElement('script');
1341
+ script2.src="//youtube.com/ytpro_cdn/npm/lrkmusic-ytpro";
1342
+ document.body.appendChild(script2);
1343
+ });
1344
+ `;
1345
+
1346
+ /*
1347
+ var script = document.createElement('script');
1348
+ script.src="//cdn.jsdelivr.net/npm/eruda";
1349
+ document.body.appendChild(script);
1350
+ script.onload = function () { eruda.init() } ;
1351
+ */
1352
+
1353
+
1354
+
1355
+ var source = doc.createTextNode(scriptSource);
1356
+ script.appendChild(source);
1357
+ doc.body.appendChild(script);
1358
+
1359
+ return iframe;
1360
+
1361
+ }
1362
+
1363
+
1364
+
1365
+ var iframe = document.getElementById("miniIframe") || createIframe();
1366
+ var player=document.getElementById("player-container-id");
1367
+
1368
+
1369
+
1370
+
1371
+ //var ogCss=getComputedStyle(player);
1372
+
1373
+ if(yes){
1374
+
1375
+ iframe.style.display="block";
1376
+
1377
+
1378
+ player.setAttribute("ogTop",getComputedStyle(player).top)
1379
+
1380
+
1381
+ player.style.transform="scale(0.65)";
1382
+ player.style.top=(window.screen.height-(player.getBoundingClientRect().height*2.5))+"px";
1383
+ player.style.zIndex="9999";
1384
+
1385
+
1386
+ }else{
1387
+
1388
+ iframe.style.display="none";
1389
+
1390
+
1391
+
1392
+ player.style.transform="scale(1)";
1393
+ player.style.top=player.getAttribute("ogTop");
1394
+ player.style.zIndex="normal";
1395
+
1396
+ player.removeAttribute("ogTop");
1397
+
1398
+
1399
+ }
1400
+ }
1401
+
1402
+
1403
+
1404
+ /*JAVA Callback for AccessToken*/
1405
+ function callbackSNlM0e(){
1406
+ return new Promise(resolve => {
1407
+ callbackSNlM0e.resolve = resolve;
1408
+ });
1409
+ }
1410
+
1411
+ /*JAVA Callback for Gemini Response*/
1412
+ function callbackGeminiClient(){
1413
+ return new Promise(resolve => {
1414
+ callbackGeminiClient.resolve = resolve;
1415
+ });
1416
+ }
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+ /*Handles the reponse*/
1423
+ function handleGeminiResponse(res){
1424
+
1425
+
1426
+ /*Extract the body from the response*/
1427
+ const getBody=(x)=>{
1428
+ for(var i in x){
1429
+ try{
1430
+ var json=JSON.parse(x[i][2]);
1431
+ if(json[4]?.[0]?.[0].indexOf("rc_") > -1) return json;
1432
+ }catch(e){console.log("JSON parse error: "+e);}}
1433
+ }
1434
+
1435
+ /*Modifies the timestamps , to handle them inside the video element*/
1436
+ const modifyTimestamps=(x)=>{
1437
+ var html=x;
1438
+ var hrefs=html.match(/href="([^"]*)"/g) || [];
1439
+ var urls= [...hrefs].map(url => url.replace(/href="|"/g, ""));
1440
+ hrefs.forEach((x,i)=>{
1441
+ var time=new URL(urls[i]).searchParams.get("t");
1442
+ if(time != null){
1443
+ html=html.replace(x,`href="javascript:void(0);" onclick="document.getElementsByClassName('video-stream')[0].currentTime='${time}'"`)
1444
+ }else if(urls[i].indexOf("youtube.com") < 0 && urls[i].indexOf("youtu.be") < 0){
1445
+ html=html.replace(x,`href="javascript:void(0);" onclick="try{document.getElementsByClassName('video-stream')[0].pause();}catch{}Android.oplink('${urls[i]}')"`)
1446
+ }
1447
+ })
1448
+ return html;
1449
+ }
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+ /*checks if the object is empty*/
1457
+ var response=res.stream;
1458
+
1459
+ if (response == undefined) return document.getElementById("GeminiResponse").innerHTML=`<center style="margin-top:15px" > An error Occurred while connecting to Gemini`;
1460
+
1461
+ var lines=response.split("\n");
1462
+ var responseJson=JSON.parse(lines[2])
1463
+
1464
+
1465
+ var body=getBody(responseJson) || [];
1466
+
1467
+ //console.log(body)
1468
+
1469
+ var chat=[];
1470
+
1471
+ chat.push(body?.[1]?.[0]);
1472
+ chat.push(body?.[1]?.[1]);
1473
+ chat.push(body?.[4]?.[0]?.[0]);
1474
+
1475
+ /*Stores the recent chat info*/
1476
+ localStorage.setItem("geminiChatInfo",chat.toString());
1477
+
1478
+
1479
+ body=body?.[4]?.[0];
1480
+
1481
+ var text=body?.[1]?.[0] || "";
1482
+ text=text.replace(/http:\/\/googleusercontent\.com\/\S+/g,'');
1483
+ var thoughts = body?.[37]?.[0]?.[0] || null;
1484
+ var images=[];
1485
+
1486
+ for(var i in body?.[12]?.[1]){
1487
+ var img=body?.[12]?.[1]?.[i]
1488
+ images.push({
1489
+ url:img[0][0][0],
1490
+ alt:img[0][4],
1491
+ title:img[7][0]
1492
+ });
1493
+
1494
+ text+=`<center><img alt="${img[0][4]}" src="${img[0][0][0]}"></center>`;
1495
+ }
1496
+
1497
+ //console.log(text,"\n\n\n-------- \n\n",thoughts)
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+ let converter = new showdown.Converter();
1505
+ converter.setFlavor('github');
1506
+ let html = modifyTimestamps(converter.makeHtml(text));
1507
+
1508
+
1509
+ let thoughtsHtml=(thoughts != null) ? `<button onclick="(this.nextElementSibling.style.height=='auto') ? (this.children[0].style.transform='rotate(-90deg)',this.nextElementSibling.style.height='0') : (this.children[0].style.transform='rotate(90deg)',this.nextElementSibling.style.height='auto');" class="think" >Show Thinking
1510
+ <svg xmlns="http://www.w3.org/2000/svg" style="transform:rotate(-90deg);margin-left:10px" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16">
1511
+ <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>
1512
+ </svg></button>
1513
+ <div class="geminiThoughts">
1514
+ <br>
1515
+ ${converter.makeHtml(thoughts)}
1516
+
1517
+
1518
+ </div><br>` : "";
1519
+
1520
+ document.getElementById("GeminiResponse").innerHTML=`<a href="https://gemini.google.com/chat/${chat[0].replace("c_","")}" >Go to the chat</a><br><br>
1521
+
1522
+ ${thoughtsHtml}
1523
+
1524
+
1525
+
1526
+ <div class="geminiAnswer">
1527
+ ${html}
1528
+ </div>
1529
+ `;
1530
+
1531
+
1532
+ }
1533
+
1534
+
1535
+
1536
+
1537
+
1538
+ /*Main Gemini Function*/
1539
+ async function geminiInfo(){
1540
+ if(document.getElementById("GeminiResponse") == null){
1541
+ var GeminiRes=document.createElement("div");
1542
+ GeminiRes.setAttribute("style",`min-height:80px;max-height:400px;display:block;height:auto;overflow:scroll;font-weight:400;width:calc(92% - 20px);font-size:14px;padding:10px;position:relative;margin:auto;background:${d};border-radius:15px;margin-bottom:8px;`);
1543
+ GeminiRes.setAttribute("id","GeminiResponse");
1544
+
1545
+
1546
+ insertAfter(document.getElementById('ytproMainDivE'),GeminiRes);
1547
+
1548
+ }else{
1549
+ var GeminiRes=document.getElementById("GeminiResponse");
1550
+ }
1551
+
1552
+
1553
+ document.getElementById("GeminiResponse").innerHTML=`
1554
+ <div class="geminiLoader"></div>`;
1555
+
1556
+ var cookies=Android.getAllCookies(window.location.href);
1557
+
1558
+ if(cookies.indexOf("__Secure-1PSID=") < 0){
1559
+ GeminiRes.innerHTML=`
1560
+ <center style="margin-top:15px">
1561
+ <span >Sign in to use Gemini<span>
1562
+ <br><br>
1563
+ <a href="https://accounts.google.com/ServiceLogin?service=youtube" >
1564
+ <button style="background:${c};color:${isD ? "#000" : "#fff"};font-weight:500;height:35px;width:90px;border-radius:25px;text-align:center;line-height:35px;">Sign In</button>
1565
+ </a>
1566
+ <br><br>
1567
+
1568
+ </center>`;
1569
+
1570
+ return;
1571
+
1572
+ }
1573
+
1574
+
1575
+ /*checks if the user is logged in*/
1576
+ cookies=cookies.split(";");
1577
+
1578
+ var secured="";
1579
+
1580
+ cookies.forEach((x)=>{
1581
+ if(x.indexOf("__Secure-1PSID=") > -1 || x.indexOf("__Secure-1PSIDTS=") > -1)
1582
+ secured+=x+";";
1583
+ })
1584
+
1585
+
1586
+
1587
+ var endpoint="https://gemini.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate";
1588
+ var headers=JSON.stringify({
1589
+ "accept": "*/*",
1590
+ "accept-language": "en",
1591
+ "content-type":"application/x-www-form-urlencoded;charset=UTF-8",
1592
+ "x-goog-ext-525001261-jspb": GeminiModels[localStorage.getItem('geminiModel')],
1593
+ "x-same-domain": "1",
1594
+ "cookie": secured,
1595
+ "Referer": "https://gemini.google.com/",
1596
+ "Referrer-Policy": "origin"
1597
+ });
1598
+
1599
+
1600
+ if(GeminiAT == ""){
1601
+ Android.getSNlM0e(secured);
1602
+ GeminiAT=await callbackSNlM0e();
1603
+
1604
+ var sd = document.createElement('script');
1605
+ sd.src="//youtube.com/ytpro_cdn/npm/showdown/dist/showdown.min.js";
1606
+ document.body.appendChild(sd);
1607
+
1608
+ }
1609
+
1610
+
1611
+
1612
+
1613
+ var prompt=localStorage.getItem('prompt').replaceAll("{url}",window.location.href).replaceAll("{videoId}",new URL(window.location.href).searchParams.get("v")).replaceAll("{title}",document.getElementsByClassName('slim-video-metadata-header')[0].textContent.replaceAll("|","").replaceAll("\\","").replaceAll("?","").replaceAll("*","").replaceAll("<","").replaceAll("/","").replaceAll(":","").replaceAll('"',"").replaceAll(">",""));
1614
+ //`send me details with timestamps and images related to this youtube com video ${}`;
1615
+ // , including all the aspects and scopes with timestamp , add facts in the analysis as well ,Here's the youtube
1616
+
1617
+
1618
+
1619
+ var chat = null;
1620
+
1621
+ if(localStorage.getItem("saveCInfo") == "true" && localStorage.getItem("geminiChatInfo") != null){
1622
+ chat = localStorage.getItem("geminiChatInfo").split(",");
1623
+ }
1624
+
1625
+ const formData = new URLSearchParams();
1626
+ formData.append("f.req", JSON.stringify([
1627
+ null,
1628
+ JSON.stringify([[prompt],null,chat])
1629
+ ]));
1630
+
1631
+ formData.append("at", GeminiAT);
1632
+
1633
+
1634
+
1635
+ Android.GeminiClient(endpoint,headers,formData.toString());
1636
+ var response=await callbackGeminiClient();
1637
+
1638
+ handleGeminiResponse(response);
1639
+
1640
+ }
1641
+
1642
+
1643
+ var volSvg=`<svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 0 24 24" width="16" focusable="false" aria-hidden="true" style="pointer-events: none;filter:drop-shadow(0px 0px 1px black);position:absolute;top:10%"><path fill="#fff" d="M11.485 2.143 3.913 6.687A6 6 0 001 11.832v.338a6 6 0 002.913 5.144l7.572 4.543A1 1 0 0013 21V3a1.001 1.001 0 00-1.515-.857Zm6.88 2.079a1 1 0 00-.001 1.414 9 9 0 010 12.728 1 1 0 001.414 1.414 11 11 0 000-15.556 1 1 0 00-1.413 0Zm-2.83 2.828a1 1 0 000 1.415 5 5 0 010 7.07 1 1 0 001.415 1.415 6.999 6.999 0 000-9.9 1 1 0 00-1.415 0Z"></path></svg>`;
1644
+ var brtSvg=`<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="16" viewBox="0 0 24 24" width="16" style="filter:drop-shadow(0px 0px 1px black);position:absolute;top:10%;"><rect fill="none" height="24" width="24"/><path fill="#fff" d="M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"/></svg>`;
1645
+
1646
+
1647
+ /*THE 0NE AND 0NLY FUNCTION*/
1648
+ async function pkc(){
1649
+
1650
+ if(window.location.href.indexOf("youtube.com/watch") > -1){
1651
+
1652
+
1653
+ try{
1654
+ var elm=document.getElementsByTagName("dislike-button-view-model")[0].children[0];
1655
+ elm.children[0].children[0].style.width="auto";
1656
+ elm.children[0].children[0].style.paddingRight="15px";
1657
+
1658
+ if(!document.getElementById("diskl")){
1659
+ var diskl=document.createElement("span");
1660
+ diskl.setAttribute("id","diskl");
1661
+ diskl.innerHTML=dislikes;
1662
+ diskl.style.marginLeft="5px";
1663
+
1664
+ insertAfter(elm.getElementsByClassName("yt-spec-button-shape-next__icon")[0],diskl);
1665
+
1666
+ }else{
1667
+ document.getElementById("diskl").innerHTML=dislikes;
1668
+ }
1669
+
1670
+ }catch(e){}
1671
+
1672
+
1673
+ //Volume and brightness slider
1674
+ try{
1675
+
1676
+ if(localStorage.getItem("gesC") == "true"){
1677
+
1678
+
1679
+ var v= document.getElementById("player-container-id");
1680
+ var rect=v.getBoundingClientRect();
1681
+
1682
+ var elStyle={
1683
+ height:"100%",
1684
+ width:rect.width*0.15+"px",
1685
+ display:"flex",
1686
+ "flex-direction":"column",
1687
+ "align-items":"center",
1688
+ "justify-content":"center",
1689
+ position:"absolute",
1690
+ top:"0px",
1691
+ right:"0px",
1692
+ opacity:"0"
1693
+ };
1694
+
1695
+
1696
+
1697
+ var el=document.createElement("div");
1698
+ var elB=document.createElement("div");
1699
+ elB.setAttribute("id","brtS");
1700
+ el.setAttribute("id","volS");
1701
+
1702
+ Object.assign(el.style,elStyle);
1703
+ Object.assign(elB.style,elStyle);
1704
+ elB.style.left="0";
1705
+
1706
+ el.innerHTML=`${volSvg}<div style="position:absolute;bottom:5%;left:calc(50% - 1.5px);background:rgba(255,255,255,0.5); height:70%;width:3px;border-radius:3px;color:red;box-shadow:0px 0px 2px black;pointer-events:none" ><div style="background:white;width:100%;height:${vol * 100}%;border-radius:3px;position:absolute;bottom:0;box-shadow:0px 0px 2px black;" id="volIS"></div></div>`;
1707
+ elB.innerHTML=`${brtSvg}<div style="position:absolute;bottom:5%;left:calc(50% - 1.5px);background:rgba(255,255,255,0.5); height:70%;width:3px;border-radius:3px;color:red;box-shadow:0px 0px 2px black;pointer-events:none" ><div style="background:white;width:100%;height:${brt * 100}%;border-radius:3px;position:absolute;bottom:0;box-shadow:0px 0px 1px black;" id="brtIS"></div></div>`;
1708
+
1709
+
1710
+ if(!document.getElementById("brtS")){
1711
+ document.getElementById("player-container-id").appendChild(elB);
1712
+
1713
+ elB.addEventListener("touchmove",(e)=>{
1714
+ e.preventDefault();
1715
+ elB.style.opacity="1";
1716
+
1717
+ var diff= touchstartY - e.touches[0].pageY;
1718
+
1719
+ if(diff > 0){
1720
+ brt +=sens;
1721
+ }else{
1722
+ brt -=sens;
1723
+ }
1724
+
1725
+ if(brt > 1) brt=1;
1726
+ if(brt < 0) brt =0;
1727
+
1728
+ touchstartY=e.touches[0].pageY;
1729
+
1730
+ Android.setBrightness(brt);
1731
+ document.getElementById("brtIS").style.height=brt*100+"%";
1732
+
1733
+ },{ passive: false })
1734
+
1735
+
1736
+ //hide the element after touch endas
1737
+ elB.addEventListener("touchend",(e)=>{
1738
+ elB.style.opacity="0";
1739
+ },{ passive: false });
1740
+
1741
+ }
1742
+
1743
+
1744
+
1745
+
1746
+
1747
+ if(!document.getElementById("volS")){
1748
+ document.getElementById("player-container-id").appendChild(el);
1749
+
1750
+ el.addEventListener("touchmove",(e)=>{
1751
+ e.preventDefault();
1752
+ el.style.opacity="1";
1753
+
1754
+ var diff= touchstartY - e.touches[0].pageY;
1755
+
1756
+ if(diff > 0){
1757
+ vol +=sens;
1758
+ }else{
1759
+ vol -=sens;
1760
+ }
1761
+
1762
+ if(vol > 1) vol=1;
1763
+ if(vol < 0) vol =0;
1764
+
1765
+ touchstartY=e.touches[0].pageY;
1766
+
1767
+ Android.setVolume(vol);
1768
+ document.getElementById("volIS").style.height=vol * 100 +"%";
1769
+
1770
+ },{ passive: false })
1771
+
1772
+
1773
+
1774
+ //hide the element after touch endas , yes endas
1775
+ el.addEventListener("touchend",(e)=>{
1776
+ el.style.opacity="0";
1777
+ },{ passive: false });
1778
+
1779
+ }
1780
+
1781
+ }
1782
+
1783
+
1784
+
1785
+ }catch(e){
1786
+ console.log(e)
1787
+ }
1788
+
1789
+
1790
+
1791
+
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+
1799
+ /*Check If Element Already Exists*/
1800
+ if(document.getElementById("ytproMainDivE") == null){
1801
+
1802
+
1803
+
1804
+ var ytproMainDivA=document.createElement("div");
1805
+ ytproMainDivA.setAttribute("id","ytproMainDivE");
1806
+ ytproMainDivA.setAttribute("style",`
1807
+ height:50px;width:100%;display:block;overflow:auto;
1808
+ `);
1809
+
1810
+ insertAfter(document.getElementsByClassName('slim-video-action-bar-actions')[0],ytproMainDivA);
1811
+
1812
+ var ytproMainDiv=document.createElement("div");
1813
+ ytproMainDiv.setAttribute("style",`
1814
+ height:50px;width:100%;display:flex;overflow:auto;
1815
+ align-items:center;justify-content:center;padding-left:20px;padding-right:10px;
1816
+ `);
1817
+ ytproMainDivA.appendChild(ytproMainDiv);
1818
+
1819
+ /*Gemini Button*/
1820
+ var ytproGemini=document.createElement("div");
1821
+ sty(ytproGemini);
1822
+ ytproGemini.style.width="115px";
1823
+ ytproGemini.style.height="calc(65% - 4.5px)";
1824
+ ytproGemini.style.position="relative";
1825
+ ytproGemini.style.background=`linear-gradient(${isD ? "#272727,#272727" : "#f2f2f2,#f2f2f2"}) padding-box , linear-gradient(16deg ,#4285f4 ,#9b72cb ,#d96570) border-box`;
1826
+ ytproGemini.style.border="2px solid transparent";
1827
+ ytproGemini.innerHTML=`
1828
+ <svg style="height:16px;width:16px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M16 8.016A8.522 8.522 0 008.016 16h-.032A8.521 8.521 0 000 8.016v-.032A8.521 8.521 0 007.984 0h.032A8.522 8.522 0 0016 7.984v.032z" fill="url(#prefix__paint0_radial_980_20147)"/><defs><radialGradient id="prefix__paint0_radial_980_20147" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(16.1326 5.4553 -43.70045 129.2322 1.588 6.503)"><stop offset=".067" stop-color="#9168C0"/><stop offset=".343" stop-color="#5684D1"/><stop offset=".672" stop-color="#1BA1E3"/></radialGradient></defs></svg>
1829
+ <span style="margin-left:4px">Gemini</span>
1830
+ <style type="text/css">
1831
+ #GeminiResponse img{
1832
+ max-width:90%;
1833
+ height:auto;
1834
+ border-radius:10px;
1835
+ margin-top:5px;
1836
+ }
1837
+ #GeminiResponse a{
1838
+ color:rgb(62,166,255);
1839
+ }
1840
+ .geminiLoader,.geminiLoader:before,.geminiLoader:after{
1841
+ content:'';
1842
+ height:10px;
1843
+ width:70%;
1844
+ position:absolute;
1845
+ top:15px;
1846
+ border-radius:5px;
1847
+ left:10px;
1848
+ background:${d};
1849
+ animation: geminiLoad 1s linear infinite alternate;
1850
+ }
1851
+ .geminiLoader:before{
1852
+ top:27px;
1853
+ left:0;
1854
+ }
1855
+ .geminiLoader:after{
1856
+ top:54px;
1857
+ left:0;
1858
+ width:90%;
1859
+ }
1860
+ @keyframes geminiLoad{
1861
+ 0% {
1862
+ opacity:1;
1863
+ }
1864
+ 100% {
1865
+ opacity:.4;
1866
+ }
1867
+ }
1868
+ .geminiThoughts{
1869
+ height:0;
1870
+ width:calc(100% - 30px);
1871
+ transition:5s;
1872
+ float:left;
1873
+ overflow:hidden;
1874
+ padding-left:5px;
1875
+ font-style:italic;
1876
+ border-left:3px solid ${d};
1877
+ display:block;
1878
+ float:none;
1879
+ clear:both;
1880
+ }
1881
+ .geminiAnswer{
1882
+ height:auto;
1883
+ width:100%;
1884
+ display:block;
1885
+ float:none;
1886
+ clear:both;
1887
+ }
1888
+ #GeminiResponse .think{
1889
+ background:transparent;
1890
+ font-size:1.45rem;
1891
+ width:calc(100% - 20px);
1892
+ height:20px;
1893
+ color:${isD ? "#ccc" : "#444"};
1894
+ margin-top:3px;
1895
+ text-align:left;
1896
+ display:flex;
1897
+ padding-left:5px;
1898
+ border-left:3px solid ${d};
1899
+ }
1900
+ </style>
1901
+ `;
1902
+
1903
+
1904
+
1905
+
1906
+
1907
+
1908
+ ytproMainDiv.appendChild(ytproGemini);
1909
+
1910
+
1911
+ ytproGemini.addEventListener("click",
1912
+ async function(){
1913
+
1914
+
1915
+ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer)){
1916
+ updateModel();
1917
+
1918
+ return;
1919
+ }
1920
+
1921
+ geminiInfo();
1922
+
1923
+
1924
+ });
1925
+
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+
1932
+
1933
+
1934
+
1935
+
1936
+ /*Heart Button*/
1937
+ var ytproFavElem=document.createElement("div");
1938
+ sty(ytproFavElem);
1939
+ if(!isHeart()){
1940
+ ytproFavElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path fill="${c}" d="M19.66 3.99c-2.64-1.8-5.9-.96-7.66 1.1-1.76-2.06-5.02-2.91-7.66-1.1-1.4.96-2.28 2.58-2.34 4.29-.14 3.88 3.3 6.99 8.55 11.76l.1.09c.76.69 1.93.69 2.69-.01l.11-.1c5.25-4.76 8.68-7.87 8.55-11.75-.06-1.7-.94-3.32-2.34-4.28zM12.1 18.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/></svg><span style="margin-left:8px">Heart<span>`;
1941
+ }else{
1942
+ ytproFavElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path fill="${c}" d="M13.35 20.13c-.76.69-1.93.69-2.69-.01l-.11-.1C5.3 15.27 1.87 12.16 2 8.28c.06-1.7.93-3.33 2.34-4.29 2.64-1.8 5.9-.96 7.66 1.1 1.76-2.06 5.02-2.91 7.66-1.1 1.41.96 2.28 2.59 2.34 4.29.14 3.88-3.3 6.99-8.55 11.76l-.1.09z"/></svg><span style="margin-left:8px">Heart<span>`;
1943
+ }
1944
+ ytproMainDiv.appendChild(ytproFavElem);
1945
+ ytproFavElem.addEventListener("click",()=>{ytProHeart(ytproFavElem);});
1946
+
1947
+
1948
+
1949
+ /*Download Button*/
1950
+ var ytproDownVidElem=document.createElement("div");
1951
+ sty(ytproDownVidElem);
1952
+ ytproDownVidElem.style.width="140px";
1953
+ ytproDownVidElem.innerHTML=`${downBtn.replace('width="18"','width="24"').replace('height="18"','height="24"')}<span style="margin-left:2px">Download<span>`;
1954
+ ytproMainDiv.appendChild(ytproDownVidElem);
1955
+ ytproDownVidElem.addEventListener("click",
1956
+ function(){
1957
+ window.location.hash="download";
1958
+ });
1959
+
1960
+ /*PIP Button*/
1961
+ var ytproPIPVidElem=document.createElement("div");
1962
+ sty(ytproPIPVidElem);
1963
+ ytproPIPVidElem.style.width="140px";
1964
+ ytproPIPVidElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" height="22" viewBox="0 0 24 24" width="22"><path fill="${c}" d="M18 7h-6c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V8c0-.55-.45-1-1-1zm3-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm-1 16.01H4c-.55 0-1-.45-1-1V5.98c0-.55.45-1 1-1h16c.55 0 1 .45 1 1v12.03c0 .55-.45 1-1 1z"/></svg><span style="margin-left:8px">PIP Mode<span>`;
1965
+ ytproMainDiv.appendChild(ytproPIPVidElem);
1966
+ ytproPIPVidElem.addEventListener("click",
1967
+ function(){
1968
+ PIPlayer(true);
1969
+ });
1970
+
1971
+
1972
+
1973
+
1974
+
1975
+ }
1976
+
1977
+
1978
+
1979
+
1980
+
1981
+ }else if(window.location.href.indexOf("youtube.com/shorts") > -1){
1982
+
1983
+
1984
+ let b = document.getElementById("brtS");
1985
+ let v = document.getElementById("volS");
1986
+ if (b) b.remove();
1987
+ if (v) v.remove();
1988
+
1989
+
1990
+ if(document.getElementById("ytproMainSDivE") == null){
1991
+ var ys=document.createElement("div");
1992
+ ys.setAttribute("id","ytproMainSDivE");
1993
+ ys.setAttribute("style",`width:50px;height:auto;position:relative;display:block;`);
1994
+
1995
+
1996
+ /*Download Button*/
1997
+ ysDown=document.createElement("div");
1998
+ ysDown.setAttribute("style",`
1999
+ height:48px;width:48px;display:flex;align-items:center;justify-content:center;
2000
+ background:rgba(0,0,0,.3);border-radius:50%;margin-bottom:20px;backdrop-filter:blur(3px);
2001
+ `);
2002
+ ysDown.innerHTML=downBtn.replaceAll(`${c}`,`#fff`).replace(`width="24"`,`width="30"`).replace(`height="24"`,`height="30"`);
2003
+
2004
+
2005
+ ysDown.addEventListener("click",
2006
+ function(){
2007
+ window.location.hash="download";
2008
+ });
2009
+
2010
+
2011
+ /*Heart Button*/
2012
+ ysHeart=document.createElement("div");
2013
+ ysHeart.setAttribute("style",`
2014
+ height:48px;width:48px;
2015
+ display:flex;align-items:center;justify-content:center;backdrop-filter:blur(3px);
2016
+ background:rgba(0,0,0,.3);border-radius:50%;margin-top:8px;margin-bottom:0px;
2017
+ `);
2018
+
2019
+
2020
+ if(!isHeart()){
2021
+ ysHeart.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path fill="#fff" d="M19.66 3.99c-2.64-1.8-5.9-.96-7.66 1.1-1.76-2.06-5.02-2.91-7.66-1.1-1.4.96-2.28 2.58-2.34 4.29-.14 3.88 3.3 6.99 8.55 11.76l.1.09c.76.69 1.93.69 2.69-.01l.11-.1c5.25-4.76 8.68-7.87 8.55-11.75-.06-1.7-.94-3.32-2.34-4.28zM12.1 18.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/></svg>`;
2022
+ }else{
2023
+ ysHeart.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path fill="#fff" d="M13.35 20.13c-.76.69-1.93.69-2.69-.01l-.11-.1C5.3 15.27 1.87 12.16 2 8.28c.06-1.7.93-3.33 2.34-4.29 2.64-1.8 5.9-.96 7.66 1.1 1.76-2.06 5.02-2.91 7.66-1.1 1.41.96 2.28 2.59 2.34 4.29.14 3.88-3.3 6.99-8.55 11.76l-.1.09z"/></svg>`;
2024
+ }
2025
+
2026
+
2027
+ ysHeart.addEventListener("click",
2028
+ function(){
2029
+ ytProHeart(ysHeart);
2030
+ });
2031
+
2032
+
2033
+
2034
+
2035
+
2036
+ try{
2037
+
2038
+ if(document.getElementsByClassName("reel-player-overlay-actions")[0].children[0]){
2039
+
2040
+ document.getElementsByClassName("reel-player-overlay-actions")[0].insertBefore(ys,document.getElementsByClassName("reel-player-overlay-actions")[0].children[0]);
2041
+ ys.appendChild(ysDown);
2042
+ ys.appendChild(ysHeart);
2043
+ }
2044
+ }catch{}
2045
+
2046
+ }
2047
+
2048
+ try{document.querySelectorAll('dislike-button-view-model')[0].children[0].children[0].children[0].children[1].children[0].innerHTML=dislikes;}catch{}
2049
+
2050
+
2051
+
2052
+
2053
+
2054
+ /*Watch The old and New URL*
2055
+ if(ytoldV != window.location.pathname){
2056
+ fDislikes();
2057
+ ytoldV=window.location.pathname;
2058
+ }*/
2059
+
2060
+
2061
+ }
2062
+
2063
+ }
2064
+
2065
+
2066
+ setInterval(pkc,0);
2067
+
2068
+
2069
+
2070
+
2071
+
2072
+ /*SHOW HEARTS*/
2073
+ async function showHearts(){
2074
+ var ytproH=document.createElement("div");
2075
+ var ytproHh=document.createElement("div");
2076
+ ytproHh.setAttribute("id","heartytprodiv");
2077
+ ytproH.setAttribute("id","outerheartsdiv");
2078
+ ytproH.setAttribute("style",`
2079
+ height:100%;width:100%;position:fixed;top:0;left:0;
2080
+ display:flex;justify-content:center;
2081
+ background:rgba(0,0,0,0.4);
2082
+ z-index:99999999999999;
2083
+ `);
2084
+
2085
+ ytproHh.setAttribute("style",`
2086
+ height:50%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"};
2087
+ position:absolute;bottom:20px;
2088
+ z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;text-align:center;
2089
+ `);
2090
+ ytproHh.innerHTML=`<style>#heartytprodiv a{text-decoration:none;} #heartytprodiv li{list-style:none; display:flex;align-items:center;border-radius:15px;padding:0px;background:${isD ? "rgba(0,0,0,.5)" : "#fff"};margin:5px;}</style>`;
2091
+ ytproHh.innerHTML+="Liked Videos<ul id='listurl'>";
2092
+
2093
+
2094
+ ytproHh.innerHTML+="<style>.thum{height:70px;border-radius:5px;}.thum img{float:left;height:70px;width:125px;border-radius:15px 0 0 15px;flex-shrink: 0;}</style>";
2095
+
2096
+ document.body.appendChild(ytproH);
2097
+ ytproH.appendChild(ytproHh);
2098
+
2099
+ ytproH.addEventListener("click",
2100
+ function(ev){
2101
+ if(!event.composedPath().includes(ytproHh)){
2102
+ history.back();
2103
+ }
2104
+ });
2105
+
2106
+
2107
+
2108
+ if(localStorage.getItem("hearts") == null){
2109
+ ytproHh.innerHTML+="No Videos Found";
2110
+ }else{
2111
+
2112
+ var v=JSON.parse(localStorage.getItem("hearts"));
2113
+
2114
+ if(Object.keys(v).length === 0){
2115
+ return ytproHh.innerHTML+="No Videos Found";
2116
+ }
2117
+
2118
+ for(var n=Object.keys(v).length - 1; n > -1 ; n--){
2119
+ var x=Object.keys(v)[n];
2120
+ ytproHh.innerHTML+=`<li class="thum" >
2121
+ <img onclick="window.location.href=('https://youtu.be/${x}');" src="${v[x].thumb}" ><br>
2122
+ <div style="width:calc(100% - 170px);margin-left:5px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical; -webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;" onclick="window.location.href=('https://youtu.be/${x}');" >${v[x].title}</div>
2123
+ <div style="width:calc(100% - (100% - 35px))">
2124
+ <svg onclick="remHeart(this,'${x}');" xmlns="http://www.w3.org/2000/svg" width="20" height="20" style="margin-left:0px;" fill="#f24" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
2125
+ <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"/>
2126
+ </svg>
2127
+ </span>
2128
+ </div>
2129
+ </li>`;
2130
+ await new Promise(r => setTimeout(r, 1));
2131
+ }
2132
+ }
2133
+
2134
+
2135
+
2136
+
2137
+
2138
+ }
2139
+
2140
+
2141
+
2142
+
2143
+
2144
+ /*Dil hata diya vro*/
2145
+ function remHeart(y,x){
2146
+ if(localStorage.getItem("hearts")?.indexOf(x) > -1){
2147
+ y.parentElement.parentElement.remove();
2148
+ var j=JSON.parse(localStorage.getItem("hearts") || "{}");
2149
+ delete j[x];
2150
+ localStorage.setItem("hearts",JSON.stringify(j));
2151
+ }
2152
+
2153
+ }
2154
+
2155
+ function ytProHeart(x){
2156
+
2157
+
2158
+ var vid=(new URLSearchParams(window.location.search)).get('v') || window.location.pathname.replace("/shorts/","");
2159
+
2160
+ var video=document.getElementsByClassName('video-stream')[0];
2161
+ var canvas = document.createElement('canvas');
2162
+ canvas.style.width = "1600px";
2163
+ canvas.style.height = "900px";
2164
+ canvas.style.background="black";
2165
+ var context = canvas.getContext('2d');
2166
+
2167
+ (window.location.pathname.indexOf("shorts") > -1) ? context.drawImage(video,105, 0, 90,160) : context.drawImage(video,0, 0, 320,180);
2168
+
2169
+ var dataURI = canvas.toDataURL('image/jpeg');
2170
+
2171
+
2172
+ if(window.location.pathname.indexOf("shorts") > -1){
2173
+
2174
+ var vDetails={
2175
+ thumb:dataURI,
2176
+ title:document.getElementsByClassName('ytShortsVideoTitleViewModelShortsVideoTitle')[0].textContent.replaceAll("|","").replaceAll("\\","").replaceAll("?","").replaceAll("*","").replaceAll("<","").replaceAll("/","").replaceAll(":","").replaceAll('"',"").replaceAll(">","")
2177
+ };
2178
+
2179
+ }else{
2180
+
2181
+ var vDetails={
2182
+ thumb:dataURI,
2183
+ title:document.getElementsByClassName('slim-video-metadata-header')[0].textContent.replaceAll("|","").replaceAll("\\","").replaceAll("?","").replaceAll("*","").replaceAll("<","").replaceAll("/","").replaceAll(":","").replaceAll('"',"").replaceAll(">","")
2184
+ }
2185
+
2186
+ /*
2187
+ var vDetails={
2188
+ thumb:[...ytplayer.config.args.raw_player_response?.videoDetails?.thumbnail?.thumbnails].pop().url,
2189
+ title:ytplayer.config.args.raw_player_response?.videoDetails?.title.replaceAll("|","").replaceAll("\\","").replaceAll("?","").replaceAll("*","").replaceAll("<","").replaceAll("/","").replaceAll(":","").replaceAll('"',"").replaceAll(">","")
2190
+ };*/
2191
+
2192
+ }
2193
+
2194
+
2195
+
2196
+ var g="16";
2197
+ var h=`<span style="margin-left:8px">Heart<span>`;
2198
+ (window.location.href.indexOf('youtube.com/shorts') > -1) ? h=``:h=`<span style="margin-left:8px">Heart<span>`;
2199
+ (window.location.href.indexOf('youtube.com/shorts') > -1) ? g="24" : g="24" ;
2200
+
2201
+
2202
+
2203
+ if(localStorage.getItem("hearts")?.indexOf(vid) > -1){
2204
+ var j=JSON.parse(localStorage.getItem("hearts") || "{}");
2205
+ delete j[vid];
2206
+ localStorage.setItem("hearts",JSON.stringify(j));
2207
+ x.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="${g}" height="${g}" fill="${(window.location.href.indexOf('youtube.com/shorts') > -1) ? "#fff" : c }" viewBox="0 0 24 24">
2208
+ <path d="M0 0h24v24H0V0z" fill="none"/><path fill="${(window.location.href.indexOf('youtube.com/shorts') > -1) ? "#fff" : c }" d="M19.66 3.99c-2.64-1.8-5.9-.96-7.66 1.1-1.76-2.06-5.02-2.91-7.66-1.1-1.4.96-2.28 2.58-2.34 4.29-.14 3.88 3.3 6.99 8.55 11.76l.1.09c.76.69 1.93.69 2.69-.01l.11-.1c5.25-4.76 8.68-7.87 8.55-11.75-.06-1.7-.94-3.32-2.34-4.28zM12.1 18.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/></svg>${h}`;
2209
+ }else{
2210
+ var j=JSON.parse(localStorage.getItem("hearts") || "{}");
2211
+ j[vid]=vDetails;
2212
+ localStorage.setItem("hearts",JSON.stringify(j));
2213
+ x.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="${g}" height="${g}" viewBox="0 0 24 24" ><path d="M0 0h24v24H0V0z" fill="none"/><path fill="${(window.location.href.indexOf('youtube.com/shorts') > -1) ? "#fff" : c }" d="M13.35 20.13c-.76.69-1.93.69-2.69-.01l-.11-.1C5.3 15.27 1.87 12.16 2 8.28c.06-1.7.93-3.33 2.34-4.29 2.64-1.8 5.9-.96 7.66 1.1 1.76-2.06 5.02-2.91 7.66-1.1 1.41.96 2.28 2.59 2.34 4.29.14 3.88-3.3 6.99-8.55 11.76l-.1.09z"/></svg>${h}`;
2214
+ }
2215
+
2216
+ }
2217
+
2218
+
2219
+
2220
+ /*Dil diya hai ya nhi diya!!*/
2221
+ function isHeart(){
2222
+
2223
+ if((localStorage.getItem("hearts")?.indexOf((new URLSearchParams(window.location.search)).get('v')) > -1) || (localStorage.getItem("hearts")?.indexOf(window.location.pathname.replace("/shorts/","")) > -1)){
2224
+ return true;
2225
+ }else{
2226
+ return false;
2227
+
2228
+ }
2229
+ }
2230
+
2231
+
2232
+
2233
+
2234
+
2235
+
2236
+ ///PIP MODE CONFIG
2237
+ function removePIP(){
2238
+
2239
+ isPIP=false;
2240
+ pauseAllowed = true;
2241
+ document.exitFullscreen();
2242
+
2243
+ document.getElementsByClassName('video-stream')[0].pause();
2244
+ setTimeout(()=>{
2245
+ document.getElementsByClassName('video-stream')[0].play();
2246
+ },5);
2247
+
2248
+
2249
+ }
2250
+
2251
+
2252
+
2253
+
2254
+ function PIPlayer(pip = false){
2255
+
2256
+ var v=document.getElementsByClassName('video-stream')[0];
2257
+
2258
+
2259
+ if(pip){
2260
+
2261
+ if(v.getBoundingClientRect().height > v.getBoundingClientRect().width){
2262
+ Android.pipvid("portrait");
2263
+ }
2264
+ else{
2265
+ Android.pipvid("landscape");
2266
+ }
2267
+
2268
+ return;
2269
+ }
2270
+
2271
+
2272
+ v.requestFullscreen();
2273
+ v.play();
2274
+ pauseAllowed = false;
2275
+ isPIP=true;
2276
+
2277
+ }
2278
+
2279
+
2280
+
2281
+
2282
+
2283
+
2284
+
2285
+
2286
+
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+ // well this is for bypassing the pause function of Youtube when video is in
2298
+ // PIP mode; skip on YT Music so playback works normally
2299
+ if (window.location.href.indexOf("music.youtube.com") === -1) {
2300
+ HTMLMediaElement.prototype.pause = function(){
2301
+
2302
+ if (pauseAllowed || PIPause) {
2303
+ return originalPause.apply(this, arguments);
2304
+ }
2305
+
2306
+ if (this.paused) {
2307
+ this.play().catch(() => {});
2308
+ }
2309
+ };
2310
+ }
2311
+
2312
+
2313
+
2314
+
2315
+
2316
+
2317
+
2318
+
2319
+
2320
+ const originalExitFullscreen = document.exitFullscreen;
2321
+ const originalRequestFullscreen = Element.prototype.requestFullscreen;
2322
+
2323
+ //exit full screen
2324
+ document.exitFullscreen = function (...args) {
2325
+ if(!isPIP){ return originalExitFullscreen.apply(this, args);}
2326
+ };
2327
+
2328
+
2329
+ //request full screen
2330
+ Element.prototype.requestFullscreen = function (...args) {
2331
+ var video = document.getElementsByClassName('video-stream')[0] || document.querySelector('video') || document.querySelector('audio');
2332
+ if (video && video.getBoundingClientRect) {
2333
+ if(video.getBoundingClientRect().height > video.getBoundingClientRect().width){
2334
+ Android.fullScreen(true);
2335
+ }
2336
+ else{
2337
+ Android.fullScreen(false);
2338
+ }
2339
+ }
2340
+ return originalRequestFullscreen.apply(this, args);
2341
+ };
2342
+
2343
+
2344
+
2345
+
2346
+
2347
+
2348
+ /*Check The Hash Change*/
2349
+ window.onhashchange=()=>{
2350
+ try{document.getElementById("outerdownytprodiv").remove();}catch{}
2351
+ try{document.getElementById("outerheartsdiv").remove();}catch{}
2352
+ try{document.getElementById("settingsprodiv").remove();}catch{}
2353
+ if(window.location.hash == "#download"){
2354
+ ytproDownVid();
2355
+ }else if(window.location.hash == "#settings"){
2356
+ ytproSettings();
2357
+ }
2358
+ else if(window.location.hash == "#hearts"){
2359
+ showHearts();
2360
+ }
2361
+
2362
+
2363
+ }
2364
+
2365
+
2366
+
2367
+ // AdBlocker which removes the ad contents from the fetch requests itself !! (skip on YT Music so playback works)
2368
+ (() => {
2369
+ if (window.location.href.indexOf("music.youtube.com") !== -1) return;
2370
+ const _origFetch = window.fetch;
2371
+ window.fetch = async function(input, init) {
2372
+ try {
2373
+ const url = (typeof input === 'string') ? input : input.url;
2374
+
2375
+ //block ad urls
2376
+ if(url.includes("googleads.g.doubleclick.net") || url.includes("youtube.com/youtubei/v1/player/ad_break") || url.includes("youtube.com/pagead/adview") || url.includes("youtube.com/api/stats/ads")){
2377
+
2378
+ //console.log("Blocked",url);
2379
+ return "";
2380
+ }else{
2381
+
2382
+
2383
+ const response = await _origFetch.apply(this, arguments);
2384
+
2385
+ try {
2386
+
2387
+ const clone = response.clone();
2388
+ let data = await clone.json();
2389
+
2390
+ if(data.responseContext.webResponseContextExtensionData.webResponseContextPreloadData.preloadMessageNames[0] == "adSlotRenderer" || data.responseContext.webResponseContextExtensionData.webResponseContextPreloadData.preloadMessageNames[0] == "shortsAdsRenderer"){
2391
+ data={};
2392
+ }
2393
+
2394
+
2395
+ //remove the ad content
2396
+ delete data.adSlots;
2397
+ delete data.playerAds;
2398
+ delete data.adPlacements;
2399
+ delete data.adBreakHeartbeatParams;
2400
+
2401
+ const newBody = JSON.stringify(data);
2402
+
2403
+ // Build new headers (update content-length + content-type)
2404
+ const newHeaders = new Headers(response.headers);
2405
+ newHeaders.set("content-length", String(newBody.length));
2406
+ newHeaders.set("content-type", "application/json");
2407
+
2408
+ // Return modified Response
2409
+ return new Response(newBody, {
2410
+ status: response.status,
2411
+ statusText: response.statusText,
2412
+ headers: newHeaders
2413
+ });
2414
+ } catch (e) {
2415
+ // not JSON, return original
2416
+ return response;
2417
+ }
2418
+
2419
+
2420
+
2421
+ }
2422
+
2423
+ } catch (e) { /* ignore logging errors */ }
2424
+
2425
+ };
2426
+
2427
+
2428
+ })();
2429
+
2430
+
2431
+
2432
+ //modified XHR for the same purpose (skip on YT Music so playback works)
2433
+ if (window.location.href.indexOf("music.youtube.com") === -1) {
2434
+ const XHR = window.XMLHttpRequest;
2435
+ const origOpen = XHR.prototype.open;
2436
+ const origSend = XHR.prototype.send;
2437
+
2438
+ XHR.prototype.open = function(method, url, ...rest) {
2439
+ this._interceptedMethod = method;
2440
+ this._interceptedUrl = url;
2441
+ return origOpen.apply(this, [method, url, ...rest]);
2442
+ };
2443
+
2444
+ XHR.prototype.send = function(body) {
2445
+ // Block certain URLs
2446
+ if (
2447
+ this._interceptedUrl.includes("googleads.g.doubleclick.net") ||
2448
+ this._interceptedUrl.includes("youtube.com/youtubei/v1/player/ad_break") ||
2449
+ this._interceptedUrl.includes("youtube.com/pagead/adview") ||
2450
+ this._interceptedUrl.includes("youtube.com/api/stats/ads")
2451
+ ) {
2452
+ console.warn("Blocked:", this._interceptedUrl);
2453
+ return;
2454
+ }
2455
+
2456
+ // Intercept JSON responses
2457
+ this.addEventListener("readystatechange", function() {
2458
+ if (this.readyState === 4 && this.responseType === "" || this.responseType === "text") {
2459
+ try {
2460
+ // Try parsing response as JSON
2461
+ const contentType = this.getResponseHeader("Content-Type");
2462
+ if (contentType && contentType.includes("application/json")) {
2463
+ let json = JSON.parse(this.responseText);
2464
+
2465
+
2466
+ // ----------------------------------------
2467
+ if (json.adPlacements) {
2468
+ console.log("Removed ad placements from response!");
2469
+ json.adPlacements = []; // remove ads
2470
+ }
2471
+
2472
+ //remove the ad content
2473
+ delete json.adSlots;
2474
+ delete json.playerAds;
2475
+ delete json.adPlacements;
2476
+ delete json.adBreakHeartbeatParams;
2477
+
2478
+
2479
+ // Redefine responseText to modified JSON
2480
+ Object.defineProperty(this, "responseText", { value: JSON.stringify(json) });
2481
+ Object.defineProperty(this, "response", { value: json });
2482
+ }
2483
+ } catch (err) {
2484
+ // Ignore non-JSON or parse errors
2485
+ }
2486
+ }
2487
+ });
2488
+
2489
+ return origSend.apply(this, arguments);
2490
+ };
2491
+ }
2492
+
2493
+
2494
+
2495
+
2496
+
2497
+
2498
+
2499
+
2500
+
2501
+
2502
+
2503
+
2504
+ /****** I LOVE YOU <3 *****/
2505
+ /*YT ADS BLOCKER*/
2506
+ function adsBlock(){
2507
+
2508
+
2509
+ try{
2510
+ document.getElementsByClassName('video-stream')[0].removeAttribute('disablepictureinpicture');
2511
+ }catch{}
2512
+
2513
+
2514
+ /*Block Ads*/
2515
+ var ads=document.getElementsByTagName("ad-slot-renderer");
2516
+ for(var x in ads){
2517
+ try{ads[x].remove();}catch{}
2518
+ }
2519
+ try{
2520
+ document.getElementsByClassName("ad-interrupting")[0].getElementsByTagName("video")[0].currentTime=document.getElementsByClassName("ad-interrupting")[0].getElementsByTagName("video")[0].duration;
2521
+ document.getElementsByClassName("ytp-ad-skip-button-modern")[0].click();
2522
+
2523
+ }catch{}
2524
+
2525
+
2526
+
2527
+
2528
+ /*Block Ads*/
2529
+ try{
2530
+ document.getElementsByTagName("ytm-promoted-sparkles-web-renderer")[0].remove();
2531
+ }catch{}
2532
+ try{
2533
+ document.getElementsByTagName("ytm-companion-ad-renderer")[0].remove();
2534
+ }catch{}
2535
+
2536
+ /*Remove Open App*/
2537
+ try{
2538
+ document.querySelectorAll('a').forEach(a => {
2539
+ if (a.href.indexOf("intent://") > -1) {
2540
+ a.style.display = 'none';
2541
+ }
2542
+ });
2543
+ }catch{}
2544
+ /*Remove Promotion Element*/
2545
+ try{document.getElementsByTagName("ytm-paid-content-overlay-renderer")[0].style.display="none";}catch{}
2546
+
2547
+ /*Hide Shorts*/
2548
+ if(localStorage.getItem("shorts") == "true"){
2549
+
2550
+
2551
+ for( x in document.getElementsByClassName("big-shorts-singleton")){
2552
+ try{document.getElementsByClassName("big-shorts-singleton")[x].remove();
2553
+ }catch{}
2554
+ }
2555
+
2556
+ for( x in document.getElementsByTagName("ytm-reel-shelf-renderer")){
2557
+ try{document.getElementsByTagName("ytm-reel-shelf-renderer")[x].remove();
2558
+ }catch{}
2559
+
2560
+ for( x in document.getElementsByTagName("ytm-shorts-lockup-view-model")){
2561
+ try{document.getElementsByTagName("ytm-shorts-lockup-view-model")[x].remove();
2562
+ }catch{}
2563
+
2564
+ }
2565
+
2566
+ }
2567
+ }
2568
+
2569
+
2570
+
2571
+
2572
+ }
2573
+
2574
+
2575
+
2576
+
2577
+
2578
+ //Add Maximize Gesture
2579
+ function addMaxButton(){
2580
+
2581
+
2582
+ var pElem=document.getElementById('player-container-id');
2583
+ var Ve=document.getElementById('player');
2584
+ var Vv=document.getElementsByClassName('video-stream')[0];
2585
+
2586
+
2587
+
2588
+ if(pElem === document.fullscreenElement){
2589
+
2590
+
2591
+ try{
2592
+ if(zoomIn){
2593
+ Ve.style.transform=`scale(${scale})`;
2594
+ }else{
2595
+ Ve.style.transform="scale(1)";
2596
+ }
2597
+ }catch{}
2598
+
2599
+
2600
+ }else{
2601
+ try{
2602
+ Ve.style.transform="scale(1)";
2603
+ }catch{}
2604
+ }
2605
+
2606
+
2607
+ }
2608
+
2609
+
2610
+
2611
+ //https://youtube.com/watch?v=SInH_fP0deQ
2612
+
2613
+
2614
+
2615
+ /*Mutation Observer*/
2616
+ //as i have been developing YTPRO for almost 4 years now
2617
+ //thus it still contains the code which i used when i was a
2618
+ //totally noob in copy pasting , that time i wasn't aware of
2619
+ //plenty of things and by which i used `setInterval` instead
2620
+ //of mutation observer , i shall be optimizing the code in future
2621
+ //releases but rn only a few code blocks will be in the obesrver
2622
+
2623
+ const targetNode = document.body;
2624
+ const config = { childList: true, subtree: true };
2625
+
2626
+ const observer = new MutationObserver(() => {
2627
+
2628
+
2629
+
2630
+
2631
+ //ads Block
2632
+ adsBlock();
2633
+
2634
+ //Setup auto-play next
2635
+ setupAutoPlayNext();
2636
+
2637
+
2638
+ //mE button
2639
+ addMaxButton();
2640
+
2641
+ //settingsTab
2642
+ addSettingsTab();
2643
+
2644
+
2645
+ try{
2646
+ var video = document.getElementsByClassName('video-stream')[0];
2647
+ if(video.getBoundingClientRect().height > video.getBoundingClientRect().width){
2648
+ Android.fullScreen(true);
2649
+ }
2650
+ else{
2651
+ Android.fullScreen(false);
2652
+ }}
2653
+ catch{}
2654
+
2655
+
2656
+ });
2657
+
2658
+ // Start observing changes in the body
2659
+ observer.observe(targetNode, config);
2660
+
2661
+
2662
+
2663
+
2664
+
2665
+ /*Update your app bruh*/
2666
+ function updateModel(){
2667
+ var x=document.createElement("div");
2668
+
2669
+ x.setAttribute("style",`height:100%;width:100%;position:fixed;display:grid;align-items:center;top:0;left:0;background:rgba(0,0,0,.6);z-index:99999;`);
2670
+
2671
+ x.innerHTML=`
2672
+ <div style="height:auto;width:70%;padding:20px;background:rgba(0,0,0,.6);border:1px solid #888;box-shadow:0px 0px 5px black;color:white;backdrop-filter:blur(10px);border-radius:15px;margin:auto">
2673
+ <h2> Mandatory Update </h2><br>
2674
+ Latest Version ${YTProVer} of YTPRO is available , update the YTPRO to get latest features.
2675
+ <br>- This update is mandatory as it fixes a ton of bugs and improves functionality <br>
2676
+ - Fixed PIP mode , BG Player , Downloads<br>
2677
+ - Fixed fitscreen bug , with pinch gesture<br>
2678
+ - Added gestures for brightness and volume control<br>
2679
+ - Optimized the UI of both Download and Settings menu<br>
2680
+ - Added new UI icons based on the latest YouTube's UI<br>
2681
+ - Fixed bugs and improved functionality<br>
2682
+ - for the full list <u onclick="Android.oplink('https://www.npmjs.com/package/lrkmusic-ytpro');" >click here</u>
2683
+ <br>
2684
+ <br>
2685
+ <div style="display:flex;">
2686
+ <!--<button style="border:0;border-radius:10px;height:30px;width:150px;background:;" onclick="this.parentElement.parentElement.parentElement.remove();">Cancel</button>-->
2687
+ <button style="border:0;border-radius:10px;height:30px;width:150px;background:rgba(255,50,50,.7);float:right;" onclick="this.parentElement.parentElement.parentElement.remove();">OK</button>
2688
+ </div>
2689
+
2690
+ </div>
2691
+ `;
2692
+
2693
+ document.body.appendChild(x);
2694
+ }
2695
+
2696
+
2697
+
2698
+
2699
+
2700
+ window.onload = function(){
2701
+ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer) && (window.location.href == "https://m.youtube.com/" || window.location.href == "https://m.youtube.com") ){
2702
+ updateModel();
2703
+ }
2704
+
2705
+ };
2706
+
2707
+
2708
+
2709
+
2710
+ document.addEventListener('click',(event) => {
2711
+
2712
+ let anchor = event.target.closest('a');
2713
+ if (anchor){
2714
+
2715
+
2716
+ if(anchor.href.includes("www.youtube.com/redirect")){
2717
+
2718
+ try{
2719
+ document.getElementsByClassName('video-stream')[0].pause();
2720
+ }catch{}
2721
+
2722
+ const url=new URL(anchor.href).searchParams.get("q");
2723
+
2724
+ setTimeout(()=>{Android.oplink(url)},50);
2725
+
2726
+ event.preventDefault();
2727
+ event.stopPropagation();
2728
+
2729
+ }
2730
+
2731
+
2732
+ }
2733
+ },
2734
+ true);
2735
+
2736
+
2737
+
2738
+
2739
+ }