1/*function convertTime(sec) { 2 var hours = Math.floor(sec/3600); 3 (hours >= 1) ? sec = sec - (hours*3600) : hours = ''; 4 var min = Math.floor(sec/60); 5 (min >= 1) ? sec = sec - (min*60) : min = '00'; 6 (sec < 1) ? sec='00' : void 0; 7 8 (hours.toString().length == 1) ? hours = '0'+hours+':' : void 0; 9 (min.toString().length == 1) ? min = '0'+min : void 0; 10 (sec.toString().length == 1) ? sec = '0'+sec : void 0; 11 12 return hours+min+':'+sec; 13} 14*/ 15 16function convertTime(sec) { 17 const hours = Math.floor(sec / 3600); 18 const minutes = Math.floor((sec % 3600) / 60); 19 const seconds = sec % 60; 20 21 const pad = (num) => String(num).padStart(2, '0'); 22 23 return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`; 24} 25 26// Fetch videos recursively and return a promise 27function fetchRutubeVideos(url, videos = []) { 28var proxyUrl = 'https://cors-get-proxy.sirjosh.workers.dev/?url='; 29// var proxyUrl = ''; 30 return new Promise((resolve, reject) => { 31 fetch(proxyUrl + encodeURIComponent(url)) 32 .then((response) => { 33 if (response.status !== 200) { 34 throw `${response.status}: ${response.statusText}`; 35 } 36 response.json().then((data) => { 37 // data = JSON.parse(data.contents); 38 videos = videos.concat(data.results); 39 progressCallback(videos); 40 if (data.next) { 41 // If there are more pages, fetch them recursively 42 fetchRutubeVideos(data.next, videos).then(resolve).catch(reject); 43 } else { 44 // All pages fetched, resolve with the combined videos array 45 resolve(videos); 46 } 47 }).catch(reject); 48 }) 49 .catch(reject); 50 }); 51} 52 53// Callback to track progress (optional) 54function progressCallback(videos) { 55 console.log(`${videos.length} loaded`); 56} 57 58// Your presentation logic here 59function presentData(data, divId, plstID) { 60 var output = ''; 61 for (let i in data) { 62 output += '\ 63 <div class="wdp-playlist-video-card-module__card">\ 64 <article class="wdp-playlist-video-card-module__content row no-gutters position-relative">\ 65 <div class="wdp-playlist-video-card-module__media col-sm-auto">\ 66 <div class="wdp-playlist-video-card-module__thumb wdp-playlist-video-card-module__thumbBackground" style="background-image:url(' + data[i].thumbnail_url + ')"></div>\ 67 <img class="wdp-playlist-video-card-module__thumb wdp-playlist-video-card-module__thumbForeground" src="' + data[i].thumbnail_url + '" alt="' + data[i].title + '">\ 68 <div class="wdp-playlist-video-card-module__duration">' + convertTime(data[i].duration) + '</div>\ 69 </div>\ 70 <div class="wdp-playlist-video-card-module__info col-sm position-static">\ 71 <a data-fancybox="' + plstID + '" href="' + data[i].embed_url + '" data-caption="' + data[i].title + '" title="' + data[i].title + '" class="stretched-link">' + data[i].title + '</a>\ 72 </div>\ 73 </article>\ 74 </div>'; 75 } 76 document.getElementById(divId).innerHTML = output; 77 78 document.getElementById(divId).style.animation = "fade 1s"; 79 document.getElementById(divId).style.opacity = "1"; 80 var preloader = document.getElementById('preloader'); 81 if(preloader) {preloader.style.display = 'none';} 82 83 $('[data-fancybox="'+plstID+'"]').fancybox({ 84 thumbs : { 85 autoStart : true, 86 axis : 'x' 87 } 88 }); 89} 90 91function presentData2(data, divId, plstID) { 92 var output2 = ''; 93 for (let i in data) { 94 output2 += '<a class="slide box-video" href="' + data[i].embed_url + '" data-fancybox="' + plstID + '" data-caption="' + data[i].title + '"><div class="slide__img b-lazy" data-src="' + data[i].thumbnail_url + '"></div><div class="bt-play"></div></a>'; 95 } 96 document.getElementById(divId).innerHTML = output2; 97} 98 99// List 100function plst(plstId, divname = 'plst_wrap', plstname = 'video-gallery') { 101//divname ??= 'plst_wrap'; 102//plstname ??= 'video-gallery'; 103//var targetUrl = 'https://rutube.ru/api/playlist/custom/' + plstId + '/videos/'; 104const targetUrl = `https://rutube.ru/api/playlist/custom/${plstId}/videos/`; 105fetchRutubeVideos(targetUrl, []) 106 .then((videos) => { 107 // All videos have been loaded 108 presentData(videos, divname, plstname); 109 }) 110 .catch(console.error); 111} 112 113// Slider 114function plstSlider(plstId, divname, plstname) { 115divname ??= 'plstSlider_wrap'; 116plstname ??= 'video-gallery-main'; 117var targetUrl = 'https://rutube.ru/api/playlist/custom/' + plstId + '/videos/'; 118fetchRutubeVideos(targetUrl, []) 119 .then((videos) => { 120 // All videos have been loaded 121 presentData2(videos, divname, plstname); 122 }) 123 .catch(console.error); 124}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.