-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.min.js
1 lines (1 loc) · 3.33 KB
/
index.min.js
1
!function(){var e,t=document.querySelector(".urlsBtn"),r=document.querySelector(".single"),n=document.querySelector(".multiple"),o=(document.querySelector(".input"),document.querySelector(".textarea"),document.querySelector("#output")),a=()=>{o.innerHTML="Fetching the video informations...";var t=(e=document.querySelector(".urlInput")).value.split(",").map(e=>e.trim()).map(e=>"https://ripsave.com/download?video="+e);Promise.all(t.map(e=>fetch(e))).then(e=>e.map(e=>e.text())).then(e=>e.map(e=>{o.innerHTML="",e.then(e=>{var t=document.createElement("p"),r=document.createElement("h3");t.innerHTML=e,t.className="vimeoVideos";var n=Array.from(t.querySelectorAll(".vimeoVideos meta")),a=Array.from(t.querySelectorAll(".vimeoVideos link")),l=Array.from(t.querySelectorAll(".vimeoVideos script")),i=Array.from(t.querySelectorAll("table a"));[...n,...a,...l].forEach(e=>e.remove()),i.forEach(e=>e.classList.add("btn","btn-primary")),console.log(c),r.className="alert alert-primary vimeoVideosTitle",null===t.querySelector(".download")?o.innerHTML='<p class="alert alert-danger">Please recheck the URL once. <br>It failed to fetch the video</p>':(o.appendChild(r),o.appendChild(t));var c=Array.from(t.querySelectorAll(".vimeoVideos title"));c.forEach(e=>r.innerHTML=e.innerHTML.split("Download: ")[1])})})).catch(e=>{if("Failed to fetch"===e.message){o.innerHTML='<p class="alert alert-danger">Error Message:<br> Failed to fetch the video.<br>Please recheck the url and try again.</p>'}else o.innerHTML="Error: "+e.name+"<br>Error Message: "+e.message})};r.onclick=(()=>{r.classList.contains("active")||(o.innerHTML="Copy the link and paste and click the button.",r.classList.add("active"),n.classList.remove("active"),t.innerHTML='<input type="text" class="form-control urlInput input" placeholder="Enter video url" aria-label="Enter video url" aria-describedby="button-addon2"><div class="input-group-append"><button class="btn btn-secondary getLinks" type="button" id="button-addon2">Get Links</button></div>'),document.querySelector(".getLinks").onclick=(()=>{0===(e=document.querySelector(".urlInput")).value.length?o.innerHTML="Please enter the url":e.value.length>0&&!e.value.match(/(vimeo.com)/gi)?o.innerHTML="This is not Vimeo's url<br>Example: 'https://vimeo.com/86359067'":a()})}),n.onclick=(()=>{n.classList.contains("active")||(o.innerHTML="Copy the link and paste and click the button.<br>Separate videos with comma(,) only<br>Example: https://vimeo.co.. , https://vimeo.co..",n.classList.add("active"),r.classList.remove("active"),t.innerHTML='<textarea name="urls" cols="30" rows="5" class="form-control urlInput textarea" aria-label="Enter videos url" aria-describedby="button-addon2"></textarea><div class="input-group-append"><button class="btn btn-secondary getLinks" type="button" id="button-addon2">Get Links</button></div>'),document.querySelector(".getLinks").onclick=(()=>{0===(e=document.querySelector(".urlInput")).value.length?o.innerHTML="Please enter the url":e.value.length>0&&!e.value.match(/(vimeo.com)/gi)?o.innerHTML="This is not Vimeo's url<br>Example: 'https://vimeo.com/86359067'":a()})}),document.querySelector(".getLinks").onclick=(()=>{0===(e=document.querySelector(".urlInput")).value.length?o.innerHTML="Please enter the url":e.value.length>0&&!e.value.match(/(vimeo.com)/gi)?o.innerHTML="This is not Vimeo's url<br>Example: 'https://vimeo.com/86359067'":a()})}();