// ==UserScript== // @name Gaston's - Video/Image Downloader // @namespace http://tampermonkey.net/ // @version 3.0 // @description Instagram/Youtube/tiktok Video/Audio Downloader alwayts updated // @author gaston1799 // @match *://www.youtube.com/* // @match *://www.instagram.com/* // @match *://music.youtube.com/* // @match *://onlymp3.app/* // @match *://onlymp3.to/* // @match *://fastdl.app/* // @match *://en.onlymp3.app/* // @match *://studio.youtube.com/* // @match *://www.yt2conv.com/* // @match *://soundcloud.com/* // @match *://sclouddownloader.net/* // @match *://www.tiktok.com/* // @match *://en3.onlinevideoconverter.pro/* // @match *://savetik.co/* // @match *://yt5s.biz/* // @match *://sss.instasaverpro.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant GM_info // @grant GM_xmlhttpRequest // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @grant GM_addValueChangeListener // @grant GM_removeValueChangeListener // @license MIT // @downloadURL none // ==/UserScript== //YT: https://www.youtube.com/channel/UCOA8lE9-0XnEIdHqjfQUz1A function getV(a,v){return GM_getValue(a)||(GM_setValue(a,v),v)} function setV(a,v){GM_setValue(a,v)} _getV=getV _setV=setV //wip for soundcload /* async function wfs(s,t){ let sleep=(ms)=>new Promise(a=>setTimeout(a,ms)); return await new Promise(async (a,b)=>{ var d=!1 var c=()=>(d=0,b()) let _=setTimeout(c,t) while(!document.querySelector(s)){ await sleep() if(d){b();break} } return a() }).then(e=>true,e=>false) } if(location.pathname=='/download-sound-track'){ document.querySelector('.btn.sc-btn').click() close() } else{ var input1='#urlInput' var button1='#submitBtn' await wfs(input1,2000) if(await wfs(input1,2000)){ document.querySelector(input1).value=url document.querySelector(button1).click() } }*/ Number.prototype.decimal=function(place){ return Number(this.toFixed(places)) } getSoundCloudUrl=()=>{ try{return findhref2(document.querySelector("#app > div.playControls.g-z-index-control-bar.m-visible > section > div > div.playControls__elements > div.playControls__soundBadge.sc-ml-3x > div"))[0].href}catch{return void 0} } var adev,set_ downloadSC=function(){ GM_setValue('tdl',null) GM_setValue('sc',getSoundCloudUrl()) !set_?(set_=1,GM_addValueChangeListener('tldl',function(a,b,c,d){ if(c&&c.title){ downloadFile_(c.url,c.title) } })):null open('https://sclouddownloader.net/') } function sleep(ms){return new Promise(a=>setTimeout(a,ms))} GM_setValue_=GM_setValue GM_getValue_=GM_getValue GM_info_=GM_info var UnmutePath='M3.15,3.85l4.17,4.17L6.16,9H3v6h3.16L12,19.93v-7.22l2.45,2.45c-0.15,0.07-0.3,0.13-0.45,0.18v1.04 c0.43-0.1,0.83-0.27,1.2-0.48l1.81,1.81c-0.88,0.62-1.9,1.04-3.01,1.2v1.01c1.39-0.17,2.66-0.71,3.73-1.49l2.42,2.42l0.71-0.71 l-17-17L3.15,3.85z M11,11.71v6.07L6.52,14H4v-4h2.52l1.5-1.27L11,11.71z M10.33,6.79L9.62,6.08L12,4.07v4.39l-1-1V6.22L10.33,6.79 z M14,8.66V7.62c2,0.46,3.5,2.24,3.5,4.38c0,0.58-0.13,1.13-0.33,1.64l-0.79-0.79c0.07-0.27,0.12-0.55,0.12-0.85 C16.5,10.42,15.44,9.1,14,8.66z M14,5.08V4.07c3.95,0.49,7,3.85,7,7.93c0,1.56-0.46,3.01-1.23,4.24l-0.73-0.73 C19.65,14.48,20,13.28,20,12C20,8.48,17.39,5.57,14,5.08z' var mutePath='M17.5,12c0,2.14-1.5,3.92-3.5,4.38v-1.04c1.44-0.43,2.5-1.76,2.5-3.34c0-1.58-1.06-2.9-2.5-3.34V7.62 C16,8.08,17.5,9.86,17.5,12z M12,4.07v15.86L6.16,15H3V9h3.16L12,4.07z M11,6.22L6.52,10H4v4h2.52L11,17.78V6.22z M21,12 c0,4.08-3.05,7.44-7,7.93v-1.01c3.39-0.49,6-3.4,6-6.92s-2.61-6.43-6-6.92V4.07C17.95,4.56,21,7.92,21,12z' downloadFileAsTitle=function (url, title,win,cb) { // Create a hidden anchor element const anchor = document.createElement('a'); anchor.style.display = 'none'; document.body.appendChild(anchor); // Fetch the file data return fetch(url) .then(response => response.blob()) .then(blob => { // Create an object URL from the blob const objectUrl = URL.createObjectURL(blob); // Set anchor attributes anchor.href = objectUrl; anchor.download = title; anchor.target = '_blank'; // Programmatically click the anchor element to trigger download anchor.click(); // Clean up the object URL URL.revokeObjectURL(objectUrl); ;(win||opener||window).postMessage({url,title,s:true},'*'); (typeof cb).includes('function')&&(cb()); }) .catch(error => { console.error('Error downloading file:', error); ;(win||opener||window).postMessage({url,title,s:false},'*') }); } function downloadFile_(url, name) { // Create an 'a' element const a = document.createElement('a'); // Set the 'href' attribute to the provided URL a.href = url; // Set the 'download' attribute to the provided name a.download = name; // Append the 'a' element to the document body document.body.appendChild(a); // Programmatically click the 'a' element to trigger the download a.click(); // Remove the 'a' element from the document body document.body.removeChild(a); } query=function(a){ return ((b)=>Object.keys(b).length?b:null)($(a)?$(a).length?$(a)[0]:$(a):null) } getElementByAttribute=function getElementByAttribute(label,item='aria-label',doc=document.body){ var res=[]; function part2(e){ if(e.getAttribute(item)==label){ res.push(e); }else{ if(e.children.length){ e=e.children; e.forEach=[].forEach; e.forEach(e2=>{ part2(e2); }) } } }; part2(doc); return res.length==1?res[0]:res||false; } get_aria_label=function(label,doc=document.body){ var res=[]; function part2(e){ if(e.getAttribute('aria-label')==label){ res.push(e); }else{ if(e.children.length){ e=e.children; e.forEach=[].forEach; e.forEach(e2=>{ part2(e2); }) } } }; part2(doc); return res[0]||false; } getClass=function(name_){ return document.getElementsByClassName("ehlq8k34")[0] } ;(function() { //'use strict'; class element { static get br() { return new element("br"); } constructor(name, obj) { //findhref2(id('skin-message'))[0].constructor.name this.element = name.constructor.name.includes('HTML')&&(name)||(function () { for (let i in arguments[1]) { arguments[0].setAttribute(i, arguments[1][i]); } return arguments[0]; })(document.createElement(arguments[0]), arguments[1]); } style(obj) { for (let i in obj) { this.element.style[i] = obj[i]; } return this; } append(target,...targets) { this.element.append(target.element || target); console.log("T:",{targets,fe:targets&&targets.forEach}) for(let i=0;i div.css-14dcx2q-DivBodyContainer.e1irlpdw0 > div:nth-child(4) > div > div.css-1qjw4dg-DivContentContainer.e1mecfx00 > div.css-1stfops-DivCommentContainer.ekjxngi0 > div > div.css-1xlna7p-DivProfileWrapper.ekjxngi4 > div.css-1u3jkat-DivDescriptionContentWrapper.e1mecfx011 > div.css-1nst91u-DivMainContent.e1mecfx01 > div.css-bs495z-DivWrapper.e1mzilcj0 > div > div.css-1d7krfw-DivOverflowContainer.e1mzilcj5 > h1").innerText.replace('Replying to ','') }catch{ try{ return document.querySelector("#app > div.css-14dcx2q-DivBodyContainer.e1irlpdw0 > div:nth-child(4) > div > div.css-1qjw4dg-DivContentContainer.e1mecfx00 > div.css-1stfops-DivCommentContainer.ekjxngi0 > div > div.css-1xlna7p-DivProfileWrapper.ekjxngi4 > div.css-1u3jkat-DivDescriptionContentWrapper.e1mecfx011 > div.css-1nst91u-DivMainContent.e1mecfx01 > div.css-bs495z-DivWrapper.e1mzilcj0").innerText.replace('Replying to ','') }catch(err){ return abc('browse-video-desc','data-e2e')?abc('browse-video-desc','data-e2e').innerText:document.querySelector("#main-content-video_detail > div > div.css-12kupwv-DivContentContainer.ege8lhx2 > div.css-1senhbu-DivLeftContainer.ege8lhx3 > div.css-1sb4dwc-DivPlayerContainer.eqrezik4 > div.css-3lfoqn-DivDescriptionContentWrapper-StyledDetailContentWrapper.eqrezik15 > div.css-r4nwrj-DivVideoInfoContainer.eqrezik3 > div.css-bs495z-DivWrapper.e1mzilcj0 > div > h1").innerText.replace('Replying to ','') } } } function sk(){ get_aria_label('Why this ad?').click(); setTimeout(()=>{ document.querySelector("#yDmH0d > c-wiz > div > div > div:nth-child(2) > div.LLEp8b > div > div.rTq3hb > div:nth-child(1) > div > div.ofmULb > div:nth-child(2) > div > button").click(); setTimeout(()=>{document.querySelector("#VGHGFf > div > div.Eddif > div:nth-child(2) > button > div.VfPpkd-RLmnJb").click();},1000) },1000) } setElement2=function (string){return string.match(/(?https?\:\/\/www\.tiktok\.com)\/(?@[^\/]+)\/video\/(?\d+)/i).groups} var Porigin='https://onlymp3.app' var Ppath='/watch?=' function ad(listener,f,autoDelete=false){ var _=addEventListener(listener,(...__)=>{f(...__);if(autoDelete)removeEventListener(_)},true) return _ } function isElementInViewport(el) { // Special bonus for those using jQuery if (typeof jQuery === "function" && el instanceof jQuery) { el = el[0]; } var rect = el.getBoundingClientRect(); return ( rect.top >= 0 - (((window.innerHeight || document.documentElement.clientHeight) / 2)) && rect.left >= 0 && rect.bottom <= ((window.innerHeight || document.documentElement.clientHeight) + ((window.innerHeight || document.documentElement.clientHeight) / 2)) && /* or $(window).height() */ rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */ ); } function tF(f,{callback,int}){ !callback&&(callback=function(){});!int&&(int=100) console.log({f,callback,int}) try{f();callback();return}catch(err){} var _=setInterval(()=>{try{f();callback();clearInterval(_);}catch(err){}},int||100) return _ } function isHidden(el) { return (el.offsetParent === null) } setElement = function(url) { return (String(url).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/)&&String(url).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/)[8].length==11)? String(url).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/)[8]: false; }; findhref2=function (a,b){ var res=[]; function part2(e){ if(e.tagName.toLowerCase()==(b||'a')){ res.push(e); if(e.children.length){ e=e.children; e.forEach=[].forEach; e.forEach(e2=>{ part2(e2); }) } }else{ if(e.children.length){ e=e.children; e.forEach=[].forEach; e.forEach(e2=>{ part2(e2); }) } } }; part2(a); return res } function parent(node){return node.parentNode} getInstalImages=function(){ return document.querySelectorAll('._acaz') } getInstaVideo=function(){ return document.querySelector('video.x1lliihq') } function GP(){ return get_aria_label('Go back')?get_aria_label('Go back').click?get_aria_label('Go back'):document.querySelector('._afxv'):document.querySelector('._afxv') } function GN(){ return get_aria_label('Next')?get_aria_label('Next').click?get_aria_label('Next'):document.querySelector('._afxw'):document.querySelector('._afxw') } function getTitle(){ try{return document.querySelector("div.x78zum5.xdt5ytf.x1iyjqo2.xs83m0k.x2lwn1j.x1odjw0f.x1n2onr6.x9ek82g.x6ikm8r.xdj266r.x11i5rnm.x4ii5y1.x1mh8g0r.xexx8yu.x1pi30zi.x18d9i69.x1swvt13 > ul > div:nth-child(3) > div > div").children[0].innerText.split('\n')[1]}catch{ return [...document.querySelectorAll('.xt0psk2.xvs91rp.xo1l8bm.x5n08af.x18hxmgj')].pop().innerText.split('\n')[0] } } downloadVideoFromBlob=function (videoElement,title) { if (videoElement && videoElement.src && videoElement.src.startsWith('blob:')) { // Create a MediaStream from the video element const stream = videoElement.captureStream(); const mediaRecorder = new MediaRecorder(stream); const chunks = []; // Capture data when available mediaRecorder.ondataavailable = event => { if (event.data.size > 0) { chunks.push(event.data); console.log(event.data) } }; // When the recording stops, create a download link mediaRecorder.onstop = () => { const blob = new Blob(chunks, { type: 'video/mp4' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = title+'.mp4'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; // Start recording mediaRecorder.start(); // Stop recording after the video duration setTimeout(() => { mediaRecorder.stop(); }, videoElement.duration * 1000); } else { console.error('Invalid video element or source.'); } } function DIV(){ if(location.href.includes('reel')){ let _=open('https://fastdl.app/en',location.href,`width=400,height=500`) var listener=GM_addValueChangeListener('instaURL',function(a,b,c,d){ if(!!c){ console.log('Got',{a,b,c,d}) _.close() GM_removeValueChangeListener(listener) downloadFile_(c,document.title+'.mp4') GM_setValue('instaURL',null) } }) } //downloadVideoFromBlob(getInstaVideo(),getTitle()) } async function DII_(){ var sleep=(a)=>new Promise(b=>setTimeout(b,a)) var srcs=new Set(),obj={} while(GP()){ await sleep(100) if(GP())GP().click() else { await sleep(1000) break; }; } var length=[...srcs].length ;[...getInstalImages()].forEach(e=>{ let a=findhref2(e,'img')[0] srcs.add([a.src,a.getAttribute('alt')]) }) GN().click() try{GN().click()}catch(err){} while(GN()){ await sleep(300) ;;[...getInstalImages()].forEach(e=>{ let a=findhref2(e,'img')[0] srcs.add([a.src,a.getAttribute('alt')]) }) try{GN().click()}catch(err){} length=[...srcs].length } while(true){ await sleep(100) if(GP())GP().click() else break; } ;[...srcs].forEach(e=>{ obj[e[0]]=e[1] }); srcs=Object.keys(obj).map(e=>({src:e,name:obj[e]})); srcs.forEach(e=>{ var ext=new URL(e.src).pathname.split('.').pop() downloadFileAsTitle(e.src,`${e.name}.${ext}`) }) console.log('done',srcs) } function DII(){ DII_().then(console.log,console.warn) } if(document.domain=='fastdl.app'){ onload=async function(){ async function wfs(a){ while(!document.querySelector(a))await sleep(0); return document.querySelector(a) } function DAIE(target, value) { const inputEvents = ['focus', 'input', 'change', 'blur']; inputEvents.forEach(eventName => { let ev=new Event(eventName, { bubbles: true, isTrusted: true }) if(target[`on${eventName}`])target[`on${eventName}`](ev) if (eventName === 'input') { target.value = value; } target.dispatchEvent(ev); }); } const info={ url:name, input:null } var cancel=false const sleep=ms=>new Promise(a=>setTimeout(a,ms)) var timeOut=setTimeout(()=>{ cancel=true },20000) while(!document.querySelector('#search-form-input')){ await sleep(0) if(cancel)throw "Cant find input" } info.input=document.querySelector('#search-form-input') console.log('Found a') DAIE(info.input,info.url); document.querySelector('.search-form__button').click() GM_setValue('instaURL',await wfs('.button--filled').then(e=>e.href)) } } else if(document.domain=='soundcloud.com'){ getSoundCloadI=function(){ _setV('SC',getSoundCloudUrl()) var b_=open('https://sclouddownloader.net/','SC') b_.onclose=function(r){ console.log('Win closed') } } return } else if(document.domain=='studio.youtube.com'){ return void function(){ var item var list var forB var __; var loop=setInterval(()=>{ var l try{ var item=[...document.querySelectorAll('#video-list')].map(e=>[e,[...e.classList]]).filter(e=>e[1].includes("ytcp-video-section"))[0][0]; var list=[...item.children[1].children].map(e=>[e,[...e.classList],e.tagName]).filter(e=>e[2]=='YTCP-VIDEO-ROW') var forB=list[0][0].children[0].querySelectorAll('.cell-body.tablecell-visibility.style-scope.ytcp-video-row') l=true }catch{l=false} if(__!=l)__=l,console.log('Change?',l?"Found":"Not FOund") },0) //forB[0].innerText.incluides('Public') }() } else if(document.domain=='www.instagram.com'){ var int; function setButtons(){ console.log('Appended buttons man') var container=new element(document.querySelectorAll('.xh8yej3.x1iyjqo2')[0]) var button=new element('button',{id:"MediaButton"}).set('innerText','Get Images').on('click',DII) var button2=new element('button',{id:"MediaButton2"}).set('innerText','Get Videos').on('click',DIV) container.append(button,button2) } function setButtons2(){ var container=new element(document.querySelector('._aaqy')) var button=new element('button',{id:"MediaButton"}).set('innerText','Get Images').on('click',DII) var button2=new element('button',{id:"MediaButton2"}).set('innerText','Get Videos').on('click',DIV) container.append(button,button2) } tF(function(){ document.querySelectorAll('.xh8yej3.x1iyjqo2')[0].children },{callback:function(){ setButtons(); setInterval(()=>{ if(!document.querySelector('#MediaButton'))setButtons() if(document.querySelector('._aaqy')&&!document.querySelector('._aaqy').querySelector('#MediaButton'))setButtons2(); }) }}) console.log('Insta ballz') return } else if(document.domain=='sclouddownloader.net'){ (async function (){ var url=_getV('SC') async function wfs(s,t){ let sleep=(ms)=>new Promise(a=>setTimeout(a,ms)); return await new Promise(async (a,b)=>{ var d=!1 var c=()=>(d=0,b()) let _=setTimeout(c,t) while(!document.querySelector(s)){ await sleep() if(d){b();break} } return a() }).then(e=>true,e=>false) } if(location.pathname=='/download-sound-track'){ await wfs('#trackTitle') while(!trackTitle.innerText.length)await sleep(0) await wfs('#trackLink') while(!trackLink.href.length)await sleep(0) _setV('SCinfo',{ name:trackTitle.innerText, href:trackLink.href }) close() } else{ if(!_getV('SC'))throw "Bruv" var input1='#urlInput' var button1='#submitBtn' await wfs(input1,2000) if(await wfs(input1,2000)){ document.querySelector(input1).value=url console.log('EZ url',!!window.formSubmit) try{while(typeof formSubmit=='undefined')await sleep(0),console.log('EZ url',formSubmit);}catch{} console.log('EZ url',formSubmit) formSubmit() console.warn('Got') setInterval(formSubmit,1000) } } })().then(console.log,console.warn) } function getIds(){ if(document.domain.includes("music")){alert('These button dont work on youtube music yet');throw "."} var list=[...document.getElementsByTagName('ytd-playlist-panel-renderer')].filter(isElementInViewport).filter(e=>!isHidden(e))[0] var ids=findhref2(list,'span').filter(e=>!isHidden(e)).filter(isElementInViewport).filter(e=>e.id=='video-title').map(parent).map(parent).map(e=>({id:setElement(findhref2(parent(e))[0].href),e})) return ids } _getIds=getIds info={} downloadT=function(id,force=false,useT=true,mp4=false,manual=false){ let _=id+(mp4?"mp4":"mp3") + useT if((localStorage[_])&&!force&&(manual?!confirm(`You have already download this video as .${mp4?"mp4":"mp3"}\nStill download?`):true))return; var video={} var hash=`#url=https://www.youtube.com/watch?v=${id}` ad('unload',function(){info[id].close()},true) onmessage=function(e){ if(e.origin==Porigin||e.origin.match(/https?:\/{2}onlymp3\.to/)||e.origin.match(/https?:\/{2}en\.onlymp3\.to/)||e.origin.match(/https?:\/{2}en(\d)\.onlinevideoconverter\.pro/)||e.origin=='https://sss.instasaverpro.com'){ const {data:{href,title,length,id}}=e console.log('Handled',{href,title,length,id},e) //info[id].close() if(useT){ var a=document.createElement('a') a.download=title+'.mp4' a.href=href //a.target='_blank' document.body.appendChild(a) a.click() a.remove(); } else open(href); localStorage[_]=href }else console.log('Unhandled Post',e) } //`https://downvideo.quora-wiki.com/tiktok-video-downloader#url=https://www.youtube.com/watch?v=${id}` var o=new URL(location.href) o.host=o.host.replace('.com','mz.com'); //open([o.protocol,'//',o.host,o.pathname,'?v=',setElement(location.href)].join('')) return info[id]=mp4? open(location.pathname.startsWith('/shorts/')?"https://yt5s.biz/enxj100/":'https://en3.onlinevideoconverter.pro/112Ei/youtube-downloader-mp4',[id,location.pathname.startsWith('/shorts/')?1:0,mp4+false],`width=400,height=500`) :open([o.protocol,'//',o.host,o.pathname,'?v=',id].join(''),[id,location.pathname.startsWith('/shorts/')?1:0],`width=400,height=500`) } var tiktikWin async function waitTT(){ while(tiktikWin&&!tiktikWin.closed)await sleep(0); return 1 } downloadTikTok=function(a,b){ (async function(mp4,info){ await waitTT() console.log('ez') let id=info.videoID let user=info.username let title_=getTikTokTittle() onmessage=function(e){ if(e.origin==Porigin||e.origin.match(/https?:\/{2}savetik\.csavetik.coo/)||e.origin.match(/https?:\/{2}en\.onlymp3\.to/)||e.origin.match(/https?:\/{2}en(\d)\.onlinevideoconverter\.pro/)||e.origin=="https://savetik.co"){ var {data:{href,links,title,length,id,mp4,info:{username}}}=e console.log('Handled',{href,title,length,id,links,mp4},e) //info[id].close() if(e.origin=="https://savetik.co"){ title=title_ downloadFileAsTitle(mp4?links[0]:links.pop(),username+" - "+title+(mp4?'.mp4':".mp3"),tiktikWin) }else{ if(useT){ let a=document.createElement('a') a.download=title+'.mp3' a.href=href document.body.appendChild(a) a.click() a.remove(); } else open(href); localStorage[_]=href } }else console.log('Unhandled Post',e) } tiktikWin=open("https://savetik.co/en",[`https://www.tiktok.com/${user}/video/${id}`,mp4+false],`width=400,height=500`) })(a,b).then(console.log,console.warn) } function abc(label, item = 'aria-label', doc = document.body) { var res = []; function part2(e) { var found=false if (!item) { [...e.attributes].map(e => { const { name, value } = e; return { name, value } }).filter(e => e.value == label).length ? (res.push(e),found=1) : null } else if (e.getAttribute(item) == label) { res.push(e);found=1; } if (e.children.length&&!found) { e = e.children; e.forEach = [].forEach; e.forEach(e2 => { part2(e2); }) } }; part2(doc); return res.length?res.length == 1 ? res[0] : res || false :null } abc_=abc function getElementByAttribute(label,item='aria-label',doc=document.body){ var res=[]; function part2(e){ if(e.getAttribute(item)==label){ res.push(e); }else{ if(e.children.length){ e=e.children; e.forEach=[].forEach; e.forEach(e2=>{ part2(e2); }) } } }; part2(doc); return res.length==1?res[0]:res||false; } function mtoggle(){document.querySelector('.ytp-volume-area > .ytp-mute-button').click()} function Mute(){ (abc('Mute','title')&&(abc('Mute','title')[0])||abc('Mute (m)','title')).click() } function Unmute(){ ((query('#right-controls')&&query('#right-controls').querySelectorAll('path')[0].getAttribute('d')==UnmutePath&&(abc('Mute','title')[0]))||abc('Unmute','title')||abc('Unmute (m)','title')).click() } M=Mute Um=Unmute var didmute=0 function ch3(i){ if(!i){ return false }else{ if(!i.closed){ return true }else{ return false } } } window.ch3=ch3; async function getWin(list=[ ['w1','win1'], ['w2','win2'], ['w3','win3'], ['w4','win4'] ]) { var e=false; var f await new Promise((g,h)=>{ var i=setInterval(j=>{ list.forEach(k=>{ this[k[0]]=ch3(window[k[1]]) if(!window[k[1]]&&!e){e=true;f=k[1];console.log(k)} }) if(f){ g(f); clearInterval(i) } },500); }); return f }; window.getWin=getWin function WIP(hmpd,mp4,force){ if(!hmpd); var ids=_getIds() var list=[] for(let i=0;i{ getWin( list ).then(b=>{ if((info[id]||localStorage[id])&&!force)return; console.log('download',id,index) window[b]=downloadT(id,force,true,!!mp4) window.addEventListener('unload',function(e){window[b].close()}) var rr=setInterval(e=>{ if(!window[b] || window[b].closed){window[b]=null;clearInterval(rr);console.log(b,'isclosed')} },300); }) }) } WIP_=WIP var button = (new element('button')).set("innerText","Get MP3").on('click',function(e){downloadT(setElement(location.href),true,true,false,true)}) var button2 = (new element('button')).set("innerText","Get MP4").on('click',function(e){downloadT(setElement(location.href),true,true,true,true)}) var button3 = (new element('button')).set("innerText","PlayList MP3").on('click',function(e){WIP_(2,false,false)}) var button4 = (new element('button')).set("innerText","PlayList MP4").on('click',function(e){WIP_(2,true,false)}) var tiktokButton=(new element('button')).set("innerText","Get MP4").on('click',function(e){downloadTikTok(true,setElement2(getClass("ehlq8k34")?getClass("ehlq8k34").innerText:location.href))}).style({color:'white'}) var tiktokButton3=(new element('button',{id:"tt1"})).set("innerText","Get MP4").on('click',function(e){downloadTikTok(true,setElement2(getClass("ehlq8k34")?getClass("ehlq8k34").innerText:location.href))}).style({color:'white'}) var tiktokButton2=(new element('button')).set("innerText","Get MP3").on('click',function(e){ downloadTikTok(false,setElement2(getClass("ehlq8k34")?getClass("ehlq8k34").innerText:location.href)) }).style({color:'white'}) function _ex_(){ return query('#end')||query('#right-content') } function appendButtons(){ const MainButtonContainer=_ex_() button.appendTo(MainButtonContainer) button2.appendTo(MainButtonContainer) console.log('Posted Buttons') function _ex(){ try{ if([...document.querySelectorAll('#header-description')].filter(isElementInViewport).filter(e=>!isHidden(e))[0]||query('.autoplay'))//.children[0].children[0].children[0].children[1].children[0].children[0].children[0].children[0] return [...document.querySelectorAll('#header-description')].filter(isElementInViewport).filter(e=>!isHidden(e))[0]||query('.autoplay') else return false } catch(err){ return false } } var exist=false setInterval(()=>{ if(exist!=_ex() && _ex()){ console.log("Added playlist buttons") setTimeout(()=>{ _ex().append(element.br.element); _ex().append(button3.element); _ex().append(button4.element) },100) }else if(exist!=_ex() && !_ex()){ console.log("buttons are gone?!?!") } exist=_ex() },100) } a1=[ ["youtube",function(){tF(function(){if(!_ex_()) throw "Cant append buttons yet";return true},{callback:appendButtons})}], ["tiktok",function(){ addEventListener("load",function(){ tF(function(){ if(!abc_('browse-copy','data-e2e'))throw "Cant Append"; tiktokButton.appendTo(document.querySelectorAll('.e1mecfx011')) tiktokButton2.appendTo(document.querySelectorAll('.e1mecfx011')) },{callback:function(){}}) tF(function(){ if(!document.getElementsByClassName("e13wiwn60")[0])throw "Cant Append"; tiktokButton.appendTo(document.getElementsByClassName("e13wiwn60")[0]) tiktokButton2.appendTo(document.getElementsByClassName("e13wiwn60")[0]) console.log('Posted Buttons') function _ex(){ try{ if(abc_('browse-copy','data-e2e').parentNode)//.children[0].children[0].children[0].children[1].children[0].children[0].children[0].children[0] return abc_('browse-copy','data-e2e').parentNode else return false } catch(err){ return false } } var exist=false setInterval(()=>{ if(exist!=_ex() && _ex()){ console.log("Added playlist buttons") setTimeout(()=>{ _ex().append(element.br.element); _ex().append(tiktokButton.element); _ex().append(tiktokButton2.element) },100) }else if(exist!=_ex() && !_ex()){ console.log("buttons are gone?!?!") } exist=_ex() },100) },{callback:function(){}}) }) }] ].filter(e=>location.host.includes(e[0]))[0];a1&&a1[1]&&(a1[1]());delete a1; if(location.href.includes('onlymp3.app')||location.href.includes('onlymp3.to')){ console.log('onlymp3.app') let callback=function(){}; function b_(){ var [id,shorts]=name.split(',') txtUrl.value=`https://www.youtube.com/${shorts=="1"?"shorts/":"watch?v="}${id}` getListFormats(); } function a_(){ var a=videoTitle.innerText.split('\n'), l=a.map(e=>e.match(/[:\d]+/gi)).filter(e=>!!e).pop().pop(), t=a[0].split('Title: ')[1], h=findhref2(videoTitle.parentNode)[0].href, f={ id:setElement(location.href), href:h, title:t ,length:l }; (opener||window).postMessage(f,'*') console.log('Poasted') } setInterval(()=>{ if(document.getElementById('error-text').innerText.length>5)location.reload(); },20000) console.log('Getting MP3') tF(function(f=function(){}){ b_() tF(function(f=function(){}){ a_() },{callback:close}) },{callback:function(){}}) return } if(location.href.includes("www.yt2conv.com")){ console.log('Getting MP4') let [id,shorts]=name.split(',') tF(function(f=function(){}){ var input=document.getElementById('search_txt') input.value=`https://www.youtube.com/${shorts=="1"?"shorts/":"watch?v="}${id}` document.getElementById('btn-submit').click() console.log(id,shorts) },{callback:function(){}}) tF(function(f=function(){}){ console.log(result.children.length) if(!result.children.length){document.getElementById('btn-submit').click();throw "no there"} },{int:1000,callback:function(){}}) tF(function(){ document.getElementById('btn-download').click() },{callback:function(){}}) tF(function(){ var title=$('.media-heading')[0].innerText var href=downloadbtn.href var f={id,href,title,length:{}}; console.log('Posted') ;(opener||window).postMessage(f,'*') },{callback:close}) } if(location.href.includes('yt5s.biz')){ async function wfs(s){ while(!document.querySelector(s)){ await sleep(0) } return true } !async function(){ let [id,shorts]=name.split(',') if(id.length&&shorts.length){}else return console.warn('No info Preset') var YTurl=`https://www.youtube.com/${shorts=="1"?"shorts/":"watch?v="}${id}` await wfs('#txt-url') console.log('Input Loaded') document.querySelector('#txt-url').value=YTurl await wfs('#btn-submit') console.log('GEtting res') await sleep(100) document.querySelector('#btn-submit').click() await wfs('#video_title') console.log('Got Res') var title=document.querySelector('#video_title').innerText var maxres=[0] ;[...document.querySelector('#result').querySelector('table').querySelectorAll('tr')].forEach(e=>{ var res=e.innerText.match(/(?\d+)(p|P)/i)||{} if(res.groups){ res=Number(res.groups.res) if(maxres[0]e.href) let f={title,links,mp4:mp4==1,info:setElement2(id)} let Porigin='https://www.tiktok.com' onmessage=function(e){ if(e.origin==Porigin){ var {data:{s,url,title}}=e console.log('Handled',{s,url,title},e) if(!s){ downloadFileAsTitle(url,title,null,close) }else setTimeout(close,100) //info[id].close() }else console.log('Unhandled Post',e) } ;(opener||window).postMessage(f,'*') //setTimeout(close,100) } tF(function(){document.getElementsByClassName("clearfix")[0].innerText;Fin()},{callback(){}}) } if(document.domain.includes('music')){ console.log('Added MiniPlayer Toggle with I') addEventListener('keypress',function({isTrusted,ctrlKey,shiftKey,code,target,target:{tagName}}){ if(!['INPUT','TEXTAREA'].includes(tagName)&&!ctrlKey&&!shiftKey&&isTrusted&&code=='KeyI'){ (abc_('Close player page')||abc_('Open player page')[1]).click() } }) } setInterval(e=>{ document.getElementsByClassName("ytp-ad-button-icon")[0]&&!didmute&&(console.log('muted ad'),didmute=1,Mute()); !document.getElementsByClassName("ytp-ad-button-icon")[0]&&didmute&&(console.log('unmuted video'),!function(){try{Unmute()}catch(err){console.warn('Failed unmuting')}}(),didmute=0); ;([...document.querySelectorAll('#song-video'),...document.querySelectorAll('#ytd-player')].map(p=>[...p.querySelectorAll('button')].filter(e=>e.className.includes('skip'))[0]).filter(e=>!!e)[0]&&([...document.querySelectorAll('#song-video'),...document.querySelectorAll('#ytd-player')].map(p=>[...p.querySelectorAll('button')].filter(e=>e.className.includes('skip'))[0]).filter(e=>!!e)[0].click(),console.log('Skipped d :>'))) document.getElementsByClassName('ytp-ad-overlay-close-button')[2]&&(document.getElementsByClassName('ytp-ad-overlay-close-button')[2].click(),console.log('Close ad card')) },10) })();