UNPKG

ytpro

Version:

All in one YouTube App with AdBlocker, Downloader , Background Player , PIP Mode , Google Gemini ✨ and many more features.

1,745 lines (1,280 loc) 67.1 kB
/*****YTPRO******* Author: Prateek Chaubey Version: 3.8.7 URI: https://github.com/prateek-chaubey/YTPRO */ //DEBUG /*var debug=false; var Android={ pipvid:()=>{}, gohome:()=>{}, getInfo:()=>{}, oplink:()=>{}, downvid:()=>{} }; s1: FoQR9rLpRy8 s2: PN51tJhZscE */ if(window.eruda == null && localStorage.getItem("devMode") == "true"){ //ERUDA window.location.href=`javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init();} })();`; } /**/ if(!YTProVer){ /*Few Stupid Inits*/ var YTProVer="3.87"; var ytoldV=""; var isF=false; //what is this for? var isAp=false; // oh it's for bg play const originalPause = HTMLMediaElement.prototype.pause; // well long story short , save the original pause function window.PIPause = false; // for pausing video when in PIP window.pauseAllowed = true; // allow pause by default var sTime=[]; var webUrls=["m.youtube.com","youtube.com","yout.be","accounts.google.com"]; var GeminiAT=""; var GeminiModels={ "2.0 Flash":'[null,null,null,null,"f299729663a2343f"]', //g2.0 FLASH "2.0 Flash Thinking": '[null,null,null,null,"9c17b1863f581b8a"]', //g2.0 flash thinking "2.0 Flash Thinking with apps": '[null,null,null,null,"f8f8f5ea629f5d37"]', //g2.0 flash thinking with apps '2.0 Experimental Advanced':'[null,null,null,null,"b1e46a6037e6aa9f"]', '2.5 Flash':'[1,null,null,null,"35609594dbe934d8"]', '2.5 Pro':'[1,null,null,null,"2525e3954d185b3c"]', '2.5 Experimental Advanced':'[null,null,null,null,"203e6bb81620bcfe"]', }; var YTPROCodecs={ video:["AV1","VP8","VP9","H264"], audio:["Opus","Mp4a"] } let touchstartY = 0; let touchendY = 0; if(localStorage.getItem("saveCInfo") == null || localStorage.getItem("fitS") == null || localStorage.getItem("bgplay") == null){ localStorage.setItem("autoSpn","true"); localStorage.setItem("fitS","true"); localStorage.setItem("bgplay","true"); localStorage.setItem("fzoom","false"); localStorage.setItem("saveCInfo","true"); localStorage.setItem("geminiModel","2.5 Flash"); 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 "); localStorage.setItem("devMode","false"); localStorage.setItem("block_60fps","false"); YTPROCodecs.video.forEach((x)=>{ localStorage.setItem(x,"true"); }); YTPROCodecs.audio.forEach((x)=>{ localStorage.setItem(x,"true"); }); } if(localStorage.getItem("fzoom") == "true"){ document.getElementsByName("viewport")[0].setAttribute("content",""); } if(window.location.pathname.indexOf("shorts") > -1){ ytoldV=window.location.pathname; } else{ ytoldV=(new URLSearchParams(window.location.search)).get('v') ; } /*Dark and Light Mode*/ var c="#000"; var d="#f2f2f2"; var dc="#fff"; var isD=false; var dislikes="..."; //Force Dark mode /** if(document.cookie.indexOf("PREF") < 0 || document.cookie.indexOf("f6=") < 0){ document.cookie.replace( /(?<=^|;).+?(?=\=|;|$)/g, name => location.hostname .split(/\.(?=[^\.]+\.)/) .reduceRight((acc, val, i, arr) => i ? arr[i]='.'+val+acc : (arr[i]='', arr), '') .map(domain => document.cookie=`${name}=;max-age=0;path=/;domain=${domain}`) ); document.cookie="PREF=f6=400&f7=100;"; window.location.href=window.location.href; } /**/ if(document.cookie.indexOf("f6=400") > -1){ dc ="#000";c ="#fff";d="rgba(255,255,255,0.1)"; isD=true; }else{ dc ="#fff";c="#000";d="rgba(0,0,0,0.05)"; isD=false; } var downBtn=`<svg xmlns="http://www.w3.org/2000/svg" height="18" fill="${c}" viewBox="0 0 24 24" width="18" focusable="false"><path d="M17 18v1H6v-1h11zm-.5-6.6-.7-.7-3.8 3.7V4h-1v10.4l-3.8-3.8-.7.7 5 5 5-4.9z"></path></svg>`; function override() { var videoElem = document.createElement('video'); var origCanPlayType = videoElem.canPlayType.bind(videoElem); videoElem.__proto__.canPlayType = makeModifiedTypeChecker(origCanPlayType); var mse = window.MediaSource; if (mse === undefined) return; var origIsTypeSupported = mse.isTypeSupported.bind(mse); mse.isTypeSupported = makeModifiedTypeChecker(origIsTypeSupported); } function makeModifiedTypeChecker(origChecker) { return function (type) { if (type === undefined) return ''; var disallowed_types = []; if (localStorage['H264'] === 'false') { disallowed_types.push('avc'); } if (localStorage['VP8'] === 'false') { disallowed_types.push('vp8'); } if (localStorage['VP9'] === 'false') { disallowed_types.push('vp9', 'vp09'); } if (localStorage['AV1'] === 'true') { disallowed_types.push('av01', 'av99'); } if (localStorage['Opus'] === 'false') { disallowed_types.push('opus'); } if (localStorage['Mp4a'] === 'false') { disallowed_types.push('mp4a'); } // If video type is in disallowed_types, say we don't support them for (var i = 0; i < disallowed_types.length; i++) { if (type.indexOf(disallowed_types[i]) !== -1) return ''; } if (localStorage['block_60fps'] === 'true') { var match = /framerate=(\d+)/.exec(type); if (match && match[1] > 30) return ''; } return origChecker(type); }; } override(); function insertAfter(referenceNode, newNode) { try{ referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); }catch{} } /*wait for the element , using observer*/ async function waitForElement(selector,vid) { return new Promise((resolve) => { const element = document.querySelector(selector); if(element){ if(vid && element.src != "") return resolve(element); if(!vid) return resolve(element); } const observer = new MutationObserver(() => { const el = document.querySelector(selector); if (el){ if(vid && el.src) resolve(el),observer.disconnect();; if(!vid) resolve(el),observer.disconnect();; } }); observer.observe(document.body, { childList: true, subtree: true }); }); } /*Add Settings Tab*/ var addSettingsTab=()=>{ if(document.getElementById("setDiv") == null){ var setDiv=document.createElement("div"); setDiv.setAttribute("style",` height:30px;width:30px; z-index:9999999999; font-size:22px; text-align:center;line-height:35px; `); setDiv.setAttribute("id","setDiv"); var svg=document.createElement("div"); svg.innerHTML=`<svg fill="${ window.location.href.indexOf("watch") < 0 ? c : "#fff" }" xmlns="http://www.w3.org/2000/svg" height="22" viewBox="0 0 22 22" width="22" id="hSett"><path d="M12 9.5c1.38 0 2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5-2.5-1.12-2.5-2.5 1.12-2.5 2.5-2.5m0-1c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5zM13.22 3l.55 2.2.13.51.5.18c.61.23 1.19.56 1.72.98l.4.32.5-.14 2.17-.62 1.22 2.11-1.63 1.59-.37.36.08.51c.05.32.08.64.08.98s-.03.66-.08.98l-.08.51.37.36 1.63 1.59-1.22 2.11-2.17-.62-.5-.14-.4.32c-.53.43-1.11.76-1.72.98l-.5.18-.13.51-.55 2.24h-2.44l-.55-2.2-.13-.51-.5-.18c-.6-.23-1.18-.56-1.72-.99l-.4-.32-.5.14-2.17.62-1.21-2.12 1.63-1.59.37-.36-.08-.51c-.05-.32-.08-.65-.08-.98s.03-.66.08-.98l.08-.51-.37-.36L3.6 8.56l1.22-2.11 2.17.62.5.14.4-.32c.53-.44 1.11-.77 1.72-.99l.5-.18.13-.51.54-2.21h2.44M14 2h-4l-.74 2.96c-.73.27-1.4.66-2 1.14l-2.92-.83-2 3.46 2.19 2.13c-.06.37-.09.75-.09 1.14s.03.77.09 1.14l-2.19 2.13 2 3.46 2.92-.83c.6.48 1.27.87 2 1.14L10 22h4l.74-2.96c.73-.27 1.4-.66 2-1.14l2.92.83 2-3.46-2.19-2.13c.06-.37.09-.75.09-1.14s-.03-.77-.09-1.14l2.19-2.13-2-3.46-2.92.83c-.6-.48-1.27-.87-2-1.14L14 2z"></path></svg> `; setDiv.appendChild(svg); insertAfter(document.getElementsByTagName("ytm-home-logo")[0],setDiv); if(document.getElementById("hSett") != null){ document.getElementById("hSett").addEventListener("click", function(ev){ window.location.hash="settings"; }); } } }; /*Dislikes To Locale, Credits: Return YT Dislikes*/ function getDislikesInLocale(num){ var nn=num; if (num < 1000){ nn = num; } else{ const int = Math.floor(Math.log10(num) - 2); const decimal = int + (int % 3 ? 1 : 0); const value = Math.floor(num / 10 ** decimal); nn= value * 10 ** decimal; } let userLocales; if (document.documentElement.lang) { userLocales = document.documentElement.lang; } else if (navigator.language) { userLocales = navigator.language; } else { try { userLocales = new URL( Array.from(document.querySelectorAll("head > link[rel='search']")) ?.find((n) => n?.getAttribute("href")?.includes("?locale=")) ?.getAttribute("href") )?.searchParams?.get("locale"); } catch { userLocales = "en"; } } return Intl.NumberFormat(userLocales, { notation: "compact", compactDisplay: "short", }).format(nn); } /*Skips the bad part :)*/ async function skipSponsor(){ var sDiv=document.createElement("div"); sDiv.setAttribute("style",`height:3px;pointer-events:none;width:100%;position:absolute;z-index:99;`) sDiv.setAttribute("id","sDiv"); var player = document.getElementsByClassName("video-stream")[0]; var dur=player.duration; if(isNaN(dur)) return; for(var x in sTime){ var s1=document.createElement("div"); var s2=sTime[x]; s1.setAttribute("style",`height:3px;width:${(100/dur) * (s2[1]-s2[0])}%;background:#0f8;position:absolute;z-index:9;left:${(100/dur) * s2[0]}%;`) sDiv.appendChild(s1); } var e=await waitForElement("yt-progress-bar",false); if(document.getElementById("sDiv") == null){ if(document.getElementsByClassName('ytPlayerProgressBarHost')[0] != null){ document.getElementsByClassName('ytPlayerProgressBarHost')[0].appendChild(sDiv); }else{ try{document.getElementsByClassName('ytProgressBarLineProgressBarLine')[0].appendChild(sDiv);}catch{} } } } /*Fetch The Dislikes*/ async function fDislikes(url){ var Url=new URL(url); var vID=""; if(Url.pathname.indexOf("shorts") > -1){ vID=Url.pathname.substr(8,Url.pathname.length); } else if(Url.pathname.indexOf("watch") > -1){ vID=Url.searchParams.get("v"); } fetch("https://returnyoutubedislikeapi.com/votes?videoId="+vID) .then(response => { return response.json(); }).then(jsonObject => { if('dislikes' in jsonObject){ dislikes=getDislikesInLocale(parseInt(jsonObject.dislikes)); } }).catch(error => {}); } /*Check For Sponsorships*/ async function checkSponsors(Url){ if(Url.indexOf("watch") > -1){ sTime=[]; await fetch("https://sponsor.ajay.app/api/skipSegments?videoID="+new URL(Url).searchParams.get("v")) .then(response => { return response.json(); }).then(jsonObject => { for(var x in jsonObject){ var time=jsonObject[x].segment; sTime.push(time); } }).catch(error => {}); /*Skip the Sponsor*/ var player = await waitForElement(".video-stream",true); player.ontimeupdate=()=>{ skipSponsor(); var cur=player.currentTime; for(var x in sTime){ var s2=sTime[x]; if(Math.floor(cur) == Math.floor(s2[0])){ if(localStorage.getItem("autoSpn") == "true"){ player.currentTime=s2[1]; addSkipper(s2[0]); } } } }; } } /*Add Skip Sponsor Element*/ function addSkipper(sT){ var sSDiv=document.createElement("div"); sSDiv.setAttribute("style",` height:50px;${(screen.width > screen.height) ? "width:50%;" : "width:80%;"}overflow:auto;background:rgba(130,130,130,.3); backdrop-filter:blur(6px); position:absolute;bottom:40px; line-height:50px; left:calc(15% / 2 );padding-left:10px;padding-right:10px; z-index:99999999999999;text-align:center;border-radius:25px; color:white;text-align:center; `); 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> <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;"> <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"> <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"/> <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"/> </svg> <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"> <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"/> </svg> </span>`; document.getElementById("player-control-container").appendChild(sSDiv); setTimeout(()=>{sSDiv.remove();},5000); } fDislikes(window.location.href); checkSponsors(window.location.href); if((window.location.pathname.indexOf("watch") > -1) || (window.location.pathname.indexOf("shorts") > -1)){ var unV=setInterval(() => { /*Unmute The Video*/ document.getElementsByClassName('video-stream')[0].muted=false; if(!document.getElementsByClassName('video-stream')[0].muted){ clearInterval(unV); } }, 5); } /*Funtion to set Element Styles*/ function sty(e,v){ var s={ display:"flex", alignItems:"center", justifyContent:"center", fontWeight:"550", height:"65%", minWidth:"80px", width:"auto", borderRadius:"20px", background:d, fontSize:"12px", marginRight:"5px", textAlign:"center" }; for(x in s){ e.style[x]=s[x]; } } function getGeminiModels(){ var t=""; for(var x in GeminiModels){ t+=`<br> <button onclick="localStorage.removeItem('geminiChatInfo');localStorage.setItem('geminiModel','${x}');this.parentElement.style.display='none';" ${(x == localStorage.getItem('geminiModel')) ? `style="background:${c};color:${dc};"` : "" } >${x} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${c}" viewBox="0 0 16 16"> <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"/> </svg> </button>`; } return t; } /*Get Codecs*/ function getYTPROCodecs(){ var t=`<p style="text-align:center;font-size:14px;">This feature is experimental , this may break YouTube Pro 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>`; for(var y in YTPROCodecs.video){ var x=YTPROCodecs.video[y]; t+=`<button onclick="setRemoveCodec('${x}',this)" ${("true" == localStorage.getItem(x)) ? `style="background:${c};color:${dc};"` : "" } >${x} <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"> <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"/> </svg> </button>`; } t+=`<br><br><vc style="font-size:14px">Audio Codecs</vc><br>` for(var y in YTPROCodecs.audio){ var x=YTPROCodecs.audio[y]; t+=`<button onclick="setRemoveCodec('${x}',this)" ${("true" == localStorage.getItem(x)) ? `style="background:${c};color:${dc};"` : "" } >${x} <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"> <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"/> </svg> </button>`; } t+=`<br><br> <div>Block 60FPS <span onclick="sttCnf(this,'block_60fps');" style="${sttCnf(0,0,"fzoom")}" ><b style="${sttCnf(0,1,"fzoom")}" ></b></span></div> `; 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>`; return t; } function setRemoveCodec(x,y){ if(localStorage[x] == "true"){ localStorage.setItem(x,"false"); y.style.background=isD ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)"; y.style.color=c; y.children[0].style.display="none"; }else{ localStorage.setItem(x,"true"); y.style.background=c; y.style.color=dc; y.children[0].style.display="block"; } } /*The settings tab*/ async function ytproSettings(){ var ytpSet=document.createElement("div"); var ytpSetI=document.createElement("div"); ytpSet.setAttribute("id","settingsprodiv"); ytpSetI.setAttribute("id","ssprodivI"); ytpSet.setAttribute("style",` height:100%;width:100%;position:fixed;top:0;left:0; display:flex;justify-content:center; background:rgba(0,0,0,0.7); z-index:9999; `); ytpSet.addEventListener("click", function(ev){ if(!(ev.target == ytpSetI || ytpSetI.contains(ev.target))){ history.back(); } }); ytpSetI.setAttribute("style",` height:65%;width:calc(95% - 20px);overflow:auto; background:${isD ? "#212121" : "#f1f1f1"}; position:fixed; bottom:20px; z-index:99999999999999;padding:10px;text-align:center;border-radius:25px;color:${c};text-align:center; color:${isD ? "#ccc" : "#444"};`); ytpSetI.innerHTML=`<style> @import url('https://fonts.googleapis.com/css2?family=Delius&display=swap'); #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;} #ssprodivI div{ height:10px; width:calc(100% - 20px); padding:10px; font-size:1.45rem; text-align:left; display:flex; align-items:center; position:relative; margin-top:3px; } #ssprodivI div span{ display:block; height:23px; width:40px; border-radius:40px; right:10px; position:absolute; background:#151515; } #ssprodivI div span b{ display:block; height:19px; width:19px; position:absolute; right:2px; top:2px; border-radius:50px; background:#fff; } #ssprodivI div input::placeholder{color:${ isD ? "white" : "#000"};} #ssprodivI div input,#ssprodivI div button{ height:35px; background:${isD ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)"}; width:100%; border:0; border-radius:20px; padding:10px; font-size:1.25rem; } #ssprodivI button{ background:transparent; font-size:1.45rem; width:calc(100% - 20px); height:40px; color:${isD ? "#ccc" : "#444"}; margin-top:3px; text-align:left; } #ssprodivI button svg{ float:right; } #ssprodivI .credit{ font-family: "Delius", cursive; font-style: normal; display:flex; justify-content:center; align-items:center; text-align:center; font-size:1.55rem; font-weight:bolder; color:${isD ? "#fff" : "#000"}; position:fixed; bottom:20px; width:calc(95% - 20px); left:calc(2.5% + 0px); background:${d}; border-radius:0 0 25px 25px; backdrop-filter:blur(10px); height:15px; } #ssprodivI .geminiModels,#ssprodivI .disableCodecs,#ssprodivI .geminiPrompt{ height:auto; min-height:100px; padding-bottom:12px; background:${isD ? "#212121" : "#f1f1f1"}; position:fixed; display:block; width:calc(95% - 20px); left:calc(2.5% + 0px); bottom:20px; z-index:999999; box-shadow:0px 0px 5px black; border-radius:25px; display:none; } #ssprodivI .geminiModels:before,#ssprodivI .disableCodecs:before,#ssprodivI .geminiPrompt:before{ height:100%; width:100%; background:rgba(0,0,0,.6); position:fixed; top:0; left:0; z-index:-999; } #ssprodivI .geminiPrompt textarea{ height:300px; width:95%; border-radius:20px; padding:15px; background:${d}; } #ssprodivI .disableCodecs{ column:50%; } #ssprodivI .disableCodecs button{ width:48%; column:50%; margin-right:2%; color:${c}; } </style>`; ytpSetI.innerHTML+=`<br><b style='font-size:18px' >YT PRO Settings</b> <span style="font-size:10px">v${YTProVer}</span> <br><br> <div><input type="url" placeholder="Enter Youtube URL" onkeyup="searchUrl(this,event)"></div> <br> <button onclick="window.location.hash='#hearts';">Liked Videos <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <button onclick="checkUpdates();">Check for Updates <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <div>Autoskip Sponsors <span onclick="sttCnf(this,'autoSpn');" style="${sttCnf(0,0,"autoSpn")}" ><b style="${sttCnf(0,1,"autoSpn")}"></b></span></div> <br> <div>Auto FitScreen <span onclick="sttCnf(this,'fitS');" style="${sttCnf(0,0,"fitS")}" ><b style="${sttCnf(0,1,"fitS")}" ></b></span></div> <br> <div>Force Zoom <span onclick="sttCnf(this,'fzoom');" style="${sttCnf(0,0,"fzoom")}" ><b style="${sttCnf(0,1,"fzoom")}" ></b></span></div> <br> <div>Background Play <span onclick="sttCnf(this,'bgplay');" style="${sttCnf(0,0,"bgplay")}" ><b style="${sttCnf(0,1,"bgplay")}" ></b></span></div> <br> <div>Hide Shorts <span onclick="sttCnf(this,'shorts');" style="${sttCnf(0,0,"shorts")}" ><b style="${sttCnf(0,1,"shorts")}" ></b></span></div> <br> <div>Use single Gemini chat <span onclick="sttCnf(this,'saveCInfo');" style="${sttCnf(0,0,"saveCInfo")}" ><b style="${sttCnf(0,1,"saveCInfo")}"></b></span></div> <br> <button onclick="document.getElementsByClassName('geminiModels')[0].style.display='block';document.getElementsByClassName('geminiModels')[0].innerHTML=getGeminiModels();">Select Gemini Model <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <button onclick="document.getElementsByClassName('geminiPrompt')[0].style.display='block';">Edit Gemini Prompt <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <button onclick="document.getElementsByClassName('disableCodecs')[0].style.display='block';document.getElementsByClassName('disableCodecs')[0].innerHTML=getYTPROCodecs();">Disable Codecs <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <button onclick="Android.oplink('https://github.com/prateek-chaubey/YTPRO/issues')">Report Bugs <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${isD ? "#ccc" : "#444"}" viewBox="0 0 16 16"> <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"/> </svg> </button> <br> <div>Developer Mode <span onclick="sttCnf(this,'devMode');" style="${sttCnf(0,0,"devMode")}" ><b style="${sttCnf(0,1,"devMode")}"></b></span></div> <br><br> <p style="font-size:1.25rem;width:calc(100% - 20px);margin:auto;text-align:left"><b style="font-weight:bold">Disclaimer</b>: This is an unofficial OSS Youtube Mod, all the logos and brand names are property of Google LLC.<br> You can find the source code at <a href="#" style="font-family:monospace;" onclick="Android.oplink('https://github.com/prateek-chaubey/YTPRO')" > https://github.com/prateek-chaubey/YTPRO</a> <br><br></p><br><br><br> <div class="geminiModels"> </div> <div class="geminiPrompt" style="text-align:center;"> <textarea> ${localStorage.getItem("prompt")} </textarea> <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> <br><br> </div> <div class="disableCodecs"> </div> <div class="credit" > <z style="margin-right:6px">Made with </z> <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="#fff" viewBox="-1 -1 18 18"> <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" stroke="black" ${ !isD ? "stroke-width='1'" : "" } stroke-linejoin="round" stroke-linecap="round"/> </svg> <z style="margin-left:6px">by Prateek Chaubey</z> </div> `; document.body.appendChild(ytpSet); ytpSet.appendChild(ytpSetI); } function searchUrl(x,e){ if(e.keyCode === 13 || e === "Enter"){ //window.location.href=x.value; var url="",id=""; var u=x.value; try{ url=new URL(u); }catch{ Android.showToast("Enter a valid URL"); return; } if((url.hostname.indexOf("youtube.com") > -1) || (url.hostname.indexOf("youtu.be") > -1) ){ if(url.pathname.indexOf("shorts") > -1){ id=url.pathname.substr(8,url.pathname.length); } else if(url.pathname.indexOf("watch") > -1){ id=url.searchParams.get("v"); }else if(url.hostname.indexOf("youtu.be") > -1){ id=id=url.pathname.substr(1,url.pathname.length); } } var a=document.createElement("a"); a.href=`/watch?v=${id}`; document.body.appendChild(a); try{document.getElementById("settingsprodiv").remove();}catch{} a.click(); } } function checkUpdates(){ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer) ){ updateModel(); }else{ Android.showToast("Your app is up to date"); } fetch('https://cdn.jsdelivr.net/npm/ytpro', {cache: 'reload'}); fetch('https://cdn.jsdelivr.net/npm/ytpro/bgplay.js', {cache: 'reload'}); fetch('https://cdn.jsdelivr.net/npm/ytpro/innertube.js', {cache: 'reload'}); } /*Set Configration*/ function sttCnf(x,z,y){ /*Way too complex to understand*/ if(isD){ var s=["#000","#717171","#fff"]; }else{ var s=["#fff","#909090","#151515"]; } if(typeof y == "string"){ if(localStorage.getItem(y) != "true"){ if(z == 1){ return `background:${s[0]};left:2px;`; }else{ return `background:${s[1]};`; } }else{ if(z == 1){ return `background:${s[0]};`; }else{ return `background:${s[2]};`; } } } if(localStorage.getItem(z) == "true"){ localStorage.setItem(z,"false"); x.style.background=s[1]; x.children[0].style.left="2px"; x.children[0].style.background=s[0]; } else{ localStorage.setItem(z,"true"); x.style.background=s[2]; x.children[0].style.left="auto"; x.children[0].style.right="2px"; x.children[0].style.background=s[0]; } if(localStorage.getItem("fzoom") == "false"){ document.getElementsByName("viewport")[0].setAttribute("content","width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,"); }else{ document.getElementsByName("viewport")[0].setAttribute("content",""); } if(localStorage.getItem("bgplay") == "true"){ Android.setBgPlay(true); }else{ Android.setBgPlay(false); } if(localStorage.getItem("devMode") == "false"){ try{eruda.destroy();}catch{} }else{ window.location.href=`javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init();} })();`; } } /*Format File Size*/ function formatFileSize(x){ var s=parseInt(x); let ss = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] for (var i=0; s > 1024; i++) s /= 1024; return ` | ${s.toFixed(1)} ${ss[i]}`; } /*Video Downloader*/ async function ytproDownVid(){ var ytproDown=document.createElement("div"); var ytproDownDiv=document.createElement("div"); ytproDownDiv.setAttribute("id","downytprodiv"); ytproDown.setAttribute("id","outerdownytprodiv"); ytproDown.setAttribute("style",` height:100%;width:100%;position:fixed;top:0;left:0; display:flex;justify-content:center; background:rgba(0,0,0,0.4); z-index:99999999999999; `); ytproDown.addEventListener("click", function(ev){ if(ev.target != ytproDownDiv && !(ytproDownDiv.contains(ev.target)) ){ history.back(); } }); ytproDownDiv.setAttribute("style",` height:50%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"}; position:absolute;bottom:20px; z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;text-align:center; `); document.body.appendChild(ytproDown); ytproDown.appendChild(ytproDownDiv); var id=""; if(window.location.pathname.indexOf("shorts") > -1){ id=window.location.pathname.substr(8,window.location.pathname.length); } else{ id=new URLSearchParams(window.location.search).get("v"); } ytproDownDiv.innerHTML="Loading..."; window.getDownloadStreams(); } function showHideAdaptives(){ var z=document.querySelectorAll(".adpFormats"); z.forEach((x)=>{ if(x.style.display=="none"){ x.style.display="flex"; }else{ x.style.display="none"; } }); } /*Add the meme type and extensions lol*/ function downCap(x,t){ Android.downvid(t,`https://m.youtube.com${x}`,"plain/text"); } /*Send to Download Manager*/ function YTDownVid(o,ex){ var mtype=""; if(ex ==".png"){ mtype="image/png"; }else if(ex ==".mp4"){ mtype="video/mp4"; } else if(ex ==".mp3"){ mtype="audio/mp3"; } //console.log(o.getAttribute("data-ytprourl")) Android.downvid((o.getAttribute("data-ytprotit")+ex),o.getAttribute("data-ytprourl"),mtype); } /*Checks the Direction of the Swipe*/ function checkDirection(e) { if ((touchendY > touchstartY) && (touchendY - touchstartY > 20)) { minimize(true); }else if ((touchendY < touchstartY) && (touchstartY - touchendY > 20)) {{ minimize(false); } } } /*touch start*/ document.body.addEventListener('touchstart', e => { touchstartY = e.changedTouches[0].screenY; }, { capture: true }); /*touch end*/ document.body.addEventListener('touchend', e => { //console.log(e.target.className) touchendY = e.changedTouches[0].screenY; if((e.target.className.toString().includes("video-stream") || e.target.className.toString().includes("player-controls-background")) && !document.fullscreenElement){ checkDirection(); } }, { capture: true }); navigation.addEventListener("navigate", e => { if(e.destination.url.indexOf("watch") > -1 || e.destination.url.indexOf("shorts") > -1){ fDislikes(e.destination.url); checkSponsors(e.destination.url); } }); /*minimize function to mini the video*/ function minimize(yes){ const createIframe=()=>{ var iframe=document.createElement("iframe"); iframe.setAttribute("id",`miniIframe`); iframe.setAttribute("style",` height:99.999%;width:100%; background:${c}; top:0px; line-height:50px; position:fixed; left:0; z-index:999; border:0; `); iframe.src="https://m.youtube.com/"; document.body.appendChild(iframe); var iwindow = iframe.contentWindow || iframe.contentDocument.defaultView; var doc = iwindow.document; if (doc.readyState == 'complete' ) { if (iwindow.trustedTypes && iwindow.trustedTypes.createPolicy && !iwindow.trustedTypes.defaultPolicy) { iwindow.trustedTypes.createPolicy('default', {createHTML: (string) => string,createScriptURL: string => string, createScript: string => string, }); } } iwindow.navigation.addEventListener("navigate", e => { if(e.destination.url.indexOf("youtube.com") > -1){ if(e.destination.url.indexOf("/watch") > -1 || e.destination.url.indexOf("/shorts") > -1){ window.location.href=e.destination.url; } var script = doc.createElement("script"); var scriptSource=`window.addEventListener('DOMContentLoaded', function() { var script2 = document.createElement('script'); script2.src="//cdn.jsdelivr.net/npm/ytpro"; document.body.appendChild(script2); }); `; } else{ window.location.href=e.destination.url; } }); var script = doc.createElement("script"); var scriptSource=`window.addEventListener('DOMContentLoaded', function() { var script2 = document.createElement('script'); script2.src="//cdn.jsdelivr.net/npm/ytpro"; document.body.appendChild(script2); }); `; /* var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init() } ; */ var source = doc.createTextNode(scriptSource); script.appendChild(source); doc.body.appendChild(script); return iframe; } var iframe = document.getElementById("miniIframe") || createIframe(); var player=document.getElementById("player-container-id"); //var ogCss=getComputedStyle(player); if(yes){ iframe.style.display="block"; player.setAttribute("ogTop",getComputedStyle(player).top) player.style.transform="scale(0.65)"; player.style.top=(window.screen.height-(player.getBoundingClientRect().height*2))+"px"; player.style.zIndex="9999"; }else{ iframe.style.display="none"; player.style.transform="scale(1)"; player.style.top=player.getAttribute("ogTop"); player.style.zIndex="normal"; player.removeAttribute("ogTop"); } } /*JAVA Callback for AccessToken*/ function callbackSNlM0e(){ return new Promise(resolve => { callbackSNlM0e.resolve = resolve; }); } /*JAVA Callback for Gemini Response*/ function callbackGeminiClient(){ return new Promise(resolve => { callbackGeminiClient.resolve = resolve; }); } /*Handles the reponse*/ function handleGeminiResponse(res){ /*Extract the body from the response*/ const getBody=(x)=>{ for(var i in x){ try{ var json=JSON.parse(x[i][2]); if(json[4]?.[0]?.[0].indexOf("rc_") > -1) return json; }catch(e){console.log("JSON parse error: "+e);}} } /*Modifies the timestamps , to handle them inside the video element*/ const modifyTimestamps=(x)=>{ var html=x; var hrefs=html.match(/href="([^"]*)"/g) || []; var urls= [...hrefs].map(url => url.replace(/href="|"/g, "")); hrefs.forEach((x,i)=>{ var time=new URL(urls[i]).searchParams.get("t"); if(time != null){ html=html.replace(x,`href="javascript:void(0);" onclick="document.getElementsByClassName('video-stream')[0].currentTime='${time}'"`) }else if(urls[i].indexOf("youtube.com") < 0 && urls[i].indexOf("youtu.be") < 0){ html=html.replace(x,`href="javascript:void(0);" onclick="try{document.getElementsByClassName('video-stream')[0].pause();}catch{}Android.oplink('${urls[i]}')"`) } }) return html; } /*checks if the object is empty*/ var response=res.stream; if (response == undefined) return document.getElementById("GeminiResponse").innerHTML=`<center style="margin-top:15px" > An error Occurred while connecting to Gemini`; var lines=response.split("\n"); var responseJson=JSON.parse(lines[2]) var body=getBody(responseJson) || []; //console.log(body) var chat=[]; chat.push(body?.[1]?.[0]); chat.push(body?.[1]?.[1]); chat.push(body?.[4]?.[0]?.[0]); /*Stores the recent chat info*/ localStorage.setItem("geminiChatInfo",chat.toString()); body=body?.[4]?.[0]; var text=body?.[1]?.[0] || ""; text=text.replace(/http:\/\/googleusercontent\.com\/\S+/g,''); var thoughts = body?.[37]?.[0]?.[0] || null; var images=[]; for(var i in body?.[12]?.[1]){ var img=body?.[12]?.[1]?.[i] images.push({ url:img[0][0][0], alt:img[0][4], title:img[7][0] }); text+=`<center><img alt="${img[0][4]}" src="${img[0][0][0]}"></center>`; } //console.log(text,"\n\n\n-------- \n\n"+thoughts) let converter = new showdown.Converter(); let html = modifyTimestamps(converter.makeHtml(text)); 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 <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"> <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"/> </svg></button> <div class="geminiThoughts"> <br> ${converter.makeHtml(thoughts)} </div><br>` : ""; document.getElementById("GeminiResponse").innerHTML=`<a href="https://gemini.google.com/chat/${chat[0].replace("c_","")}" >Go to the chat</a><br><br> ${thoughtsHtml} <div class="geminiAnswer"> ${html} </div> `; } /*Main Gemini Function*/ async function geminiInfo(){ if(document.getElementById("GeminiResponse") == null){ var GeminiRes=document.createElement("div"); 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;`); GeminiRes.setAttribute("id","GeminiResponse"); insertAfter(document.getElementById('ytproMainDivE'),GeminiRes); }else{ var GeminiRes=document.getElementById("GeminiResponse"); } document.getElementById("GeminiResponse").innerHTML=` <div class="geminiLoader"></div>`; var cookies=Android.getAllCookies(window.location.href); if(cookies.indexOf("__Secure-1PSID=") < 0){ GeminiRes.innerHTML=` <center style="margin-top:15px"> <span >Sign in to use Gemini<span> <br><br> <a href="https://accounts.google.com/ServiceLogin?service=youtube" > <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> </a> <br><br> </center>`; return; } /*checks if the user is logged in*/ cookies=cookies.split(";"); var secured=""; cookies.forEach((x)=>{ if(x.indexOf("__Secure-1PSID=") > -1 || x.indexOf("__Secure-1PSIDTS=") > -1) secured+=x+";"; }) var endpoint="https://gemini.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate"; var headers=JSON.stringify({ "accept": "*/*", "accept-language": "en", "content-type":"application/x-www-form-urlencoded;charset=UTF-8", "x-goog-ext-525001261-jspb": GeminiModels[localStorage.getItem('geminiModel')], "x-same-domain": "1", "cookie": secured, "Referer": "https://gemini.google.com/", "Referrer-Policy": "origin" }); if(GeminiAT == ""){ Android.getSNlM0e(secured); GeminiAT=await callbackSNlM0e(); var sd = document.createElement('script'); sd.src="//cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js"; document.body.appendChild(sd); } 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(">","")); //`send me details with timestamps and images related to this youtube com video ${}`; // , including all the aspects and scopes with timestamp , add facts in the analysis as well ,Here's the youtube var chat = null; if(localStorage.getItem("saveCInfo") == "true" && localStorage.getItem("geminiChatInfo") != null){ chat = localStorage.getItem("geminiChatInfo").split(","); } const formData = new URLSearchParams(); formData.append("f.req", JSON.stringify([ null, JSON.stringify([[prompt],null,chat]) ])); formData.append("at", GeminiAT); Android.GeminiClient(endpoint,headers,formData.toString()); var response=await callbackGeminiClient(); handleGeminiResponse(response); } /*THE 0NE AND 0NLY FUNCTION*/ async function pkc(){ if(window.location.href.indexOf("youtube.com/watch") > -1){ try{ var elm=document.getElementsByTagName("dislike-button-view-model")[0].children[0]; elm.children[0].children[0].children[0].style.width="90px"; elm.children[0].children[0].children[0].children[0].style.position="absolute"; elm.children[0].children[0].children[0].children[0].style.left="15px"; elm.parentElement.innerHTML=`<yt-button-shape class="yt-spec-button-shape-next__button-shape-wiz-class" nt="true"> <button class="yt-spec-button-shape-next yt-spec-button-shape-next--tonal yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button yt-spec-button-shape-next--segmented-end yt-spec-button-shape-next--enable-backdrop-filter-experiment" title="" aria-pressed="false" aria-label="Dislike this video" aria-disabled="false" nt="true" style="width: 80px;"><div class="yt-spec-button-shape-next__icon" aria-hidden="true" nt="true" style="position: absolute; left: 15px;"><c3-icon style="height: 24px; width: 24px;"><span class="yt-icon-shape yt-spec-icon-shape"><div style="width: 100%; height: 100%; display: block; fill: currentcolor;"><svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" focusable="false" aria-hidden="true" style="pointer-events: none; display: inherit; width: 100%; height: 100%;"><path d="M17,4h-1H6.57C5.5,4,4.59,4.67,4.38,5.61l-1.34,6C2.77,12.85,3.82,14,5.23,14h4.23l-1.52,4.94C7.62,19.97,8.46,21,9.62,21 c0.58,0,1.14-0.24,1.52-0.65L17,14h4V4H17z M10.4,19.67C10.21,19.88,9.92,20,9.62,20c-0.26,0-0.5-0.11-0.63-0.3 c-0.07-0.1-0.15-0.26-0.09-0.47l1.52-4.94l0.4-1.29H9.46H5.23c-0.41,0-0.8-0.17-1.03-0.46c-0.12-0.15-0.25-0.4-0.18-0.72l1.34-6 C5.46,5.35,5.97,5,6.57,5H16v8.61L10.4,19.67z M20,13h-3V5h3V13z"></path></svg></div></span></c3-icon></div><yt-touch-feedback-shape style="border-radius: inherit;"><div aria-hidden="true" class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"><div class="yt-spec-touch-feedback-shape__stroke"></div><div class="yt-spec-touch-feedback-shape__fill"></div></div></yt-touch-feedback-shape> <span style="margin-left:20px;margin-bottom:3px;">${dislikes}</span> </button></yt-button-shape> `; }catch(e){ } /*Check If Element Already Exists*/ if(document.getElementById("ytproMainDivE") == null){ var ytproMainDivA=document.createElement("div"); ytproMainDivA.setAttribute("id","ytproMainDivE"); ytproMainDivA.setAttribute("style",` height:50px;width:100%;display:block;overflow:auto; `); insertAfter(document.getElementsByClassName('slim-video-action-bar-actions')[0],ytproMainDivA); var ytproMainDiv=document.createElement("div"); ytproMainDiv.setAttribute("style",` height:50px;width:100%;display:flex;overflow:auto; align-items:center;justify-content:center;padding-left:20px;padding-right:10px; `); ytproMainDivA.appendChild(ytproMainDiv); /*Gemini Button*/ var ytproGemini=document.createElement("div"); sty(ytproGemini); ytproGemini.style.width="115px"; ytproGemini.style.height="calc(65% - 4.5px)"; ytproGemini.style.position="relative"; ytproGemini.style.background=`linear-gradient(${isD ? "#272727,#272727" : "#f2f2f2,#f2f2f2"}) padding-box , linear-gradient(16deg ,#4285f4 ,#9b72cb ,#d96570) border-box`; ytproGemini.style.border="2px solid transparent"; ytproGemini.innerHTML=` <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> <span style="margin-left:4px">Gemini</span> <style type="text/css"> #GeminiResponse img{ max-width:90%; height:auto; border-radius:10px; margin-top:5px; } #GeminiResponse a{ color:rgb(62,166,255); } .geminiLoader,.geminiLoader:before,.geminiLoader:after{ content:''; height:10px; width:70%; position:absolute; top:15px; border-radius:5px; left:10px; background:${d}; animation: geminiLoad 1s linear infinite alternate; } .geminiLoader:before{ top:27px; left:0; } .geminiLoader:after{ top:54px; left:0; width:90%; } @keyframes geminiLoad{ 0% { opacity:1; } 100% { opacity:.4; } } .geminiThoughts{ height:0; width:calc(100% - 30px); transition:5s; float:left; overflow:hidden; padding-left:5px; font-style:italic; border-left:3px solid ${d}; display:block; float:none; clear:both; } .geminiAnswer{ height:auto; width:100%; display:block; float:none; clear:both; } #GeminiResponse .think{ background:transparent; font-size:1.45rem; width:calc(100% - 20px); height:20px; color:${isD ? "#ccc" : "#444"}; margin-top:3px; text-align:left; display:flex; padding-left:5px; border-left:3px solid ${d}; } </style> `; ytproMainDiv.appendChild(ytproGemini); ytproGemini.addEventListener("click", async function(){ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer)){ updateModel(); return; } geminiInfo(); }); /*Heart Button*/ var ytproFavElem=document.createElement("div"); sty(ytproFavElem); if(!isHeart()){ ytproFavElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${c}" viewBox="0 0 16 16"> <path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"/> </svg><span style="margin-left:8px">Heart<span>`; }else{ ytproFavElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#f00" viewBox="0 0 16 16"> <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.314z"/> </svg><span style="margin-left:8px">Heart<span>`; } ytproMainDiv.appendChild(ytproFavElem); ytproFavElem.addEventListener("click",()=>{ytProHeart(ytproFavElem);}); /*Download Button*/ var ytproDownVidElem=document.createElement("div"); sty(ytproDownVidElem); ytproDownVidElem.style.width="140px"; ytproDownVidElem.innerHTML=`${downBtn.replace('width="18"','width="24"').replace('height="18"','height="24"')}<span style="margin-left:2px">Download<span>`; ytproMainDiv.appendChild(ytproDownVidElem); ytproDownVidElem.addEventListener("click", function(){ window.location.hash="download"; }); /*PIP Button*/ var ytproPIPVidElem=document.createElement("div"); sty(ytproPIPVidElem); ytproPIPVidElem.style.width="140px"; ytproPIPVidElem.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${c}" viewBox="0 0 16 16"> <path d="M0 3.5A1.5 1.5 0 0 1 1.5 2h13A1.5 1.5 0 0 1 16 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 12.5v-9zM1.5 3a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-13z"/> <path d="M8 8.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-5a.5.5 0 0 1-.5-.5v-3z"/> </svg> <span style="margin-left:8px">PIP Mode<span>`; ytproMainDiv.appendChild(ytproPIPVidElem); ytproPIPVidElem.addEventListener("click", function(){ PIPlayer(true); }); } }else if(window.location.href.indexOf("youtube.com/shorts") > -1){ if(document.getElementById("ytproMainSDivE") == null){ var ys=document.createElement("div"); ys.setAttribute("id","ytproMainSDivE"); ys.setAttribute("style",`width:50px;height:auto;position:relative;display:block;`); /*Download Button*/ ysDown=document.createElement("div"); ysDown.setAttribute("style",` height:48px;width:48px;display:flex;align-items:center;justify-content:center; background:rgba(0,0,0,.3);border-radius:50%;margin-bottom:20px; `); ysDown.innerHTML=downBtn.replace(`fill="${c}"`,`fill="#fff"`).replace(`width="18"`,`width="30"`).replace(`height="18"`,`height="30"`); ysDown.addEventListener("click", function(){ window.location.hash="download"; }); /*Heart Button*/ ysHeart=document.createElement("div"); ysHeart.setAttribute("style",` height:48px;width:48px; display:flex;align-items:center;justify-content:center; background:rgba(0,0,0,.3);border-radius:50%;margin-top:8px;margin-bottom:0px; `); if(!isHeart()){ ysHeart.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" fill="#fff" viewBox="0 0 16 16"> <path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"/> </svg>`; }else{ ysHeart.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" fill="#f00" viewBox="0 0 16 16"> <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.314z"/> </svg>`; } ysHeart.addEventListener("click", function(){ ytProHeart(ysHeart); }); try{ document.getElementsByClassName("reel-player-overlay-actions")[0].insertBefore(ys,document.getElementsByClassName("reel-player-overlay-actions")[0].children[0]); ys.appendChild(ysDown); ys.appendChild(ysHeart); }catch{} } try{document.querySelectorAll('[aria-label="Dislike this video"]')[0].nextElementSibling.children[0].innerHTML=dislikes;}catch{} /*Watch The old and New URL* if(ytoldV != window.location.pathname){ fDislikes(); ytoldV=window.location.pathname; }*/ } } setInterval(pkc,0); /*SHOW HEARTS*/ async function showHearts(){ var ytproH=document.createElement("div"); var ytproHh=document.createElement("div"); ytproHh.setAttribute("id","heartytprodiv"); ytproH.setAttribute("id","outerheartsdiv"); ytproH.setAttribute("style",` height:100%;width:100%;position:fixed;top:0;left:0; display:flex;justify-content:center; background:rgba(0,0,0,0.4); z-index:99999999999999; `); ytproHh.setAttribute("style",` height:50%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"}; position:absolute;bottom:20px; z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;text-align:center; `); 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>`; ytproHh.innerHTML+="Liked Videos<ul id='listurl'>"; 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>"; document.body.appendChild(ytproH); ytproH.appendChild(ytproHh); ytproH.addEventListener("click", function(ev){ if(!event.composedPath().includes(ytproHh)){ history.back(); } }); if(localStorage.getItem("hearts") == null)