NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Video // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author anonimys // @match https://namars.com/video/* // @icon https://www.google.com/s2/favicons?sz=64&domain=namars.com // @grant none // @license MIT // ==/UserScript== (function() { let isRunning = false; let videosWatched = 0; let likesGiven = 0; let videoStats = []; function calculateDurationInSeconds(durationText) { const parts = durationText.split(":"); if (parts.length === 2) { const minutes = parseInt(parts[0], 10); const seconds = parseInt(parts[1], 10); return minutes * 60 + seconds; } else { return 0; } } function getRandomDelay(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } async function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function makeLike() { const likeButton = document.querySelector('.video__primary-like-dislike.btn-success'); if (likeButton) { likeButton.click(); likesGiven++; updateStats(); } } async function watchShortestVideo() { const videoElements = document.querySelectorAll('.video-slide__duration2'); if (videoElements.length === 0) { return null; } let shortestDuration = Infinity; let shortestVideoElement = null; videoElements.forEach(videoElement => { const durationText = videoElement.textContent; const durationInSeconds = calculateDurationInSeconds(durationText); if (durationInSeconds < shortestDuration) { shortestDuration = durationInSeconds; shortestVideoElement = videoElement; } }); if (shortestVideoElement) { const watchButton = shortestVideoElement.nextElementSibling; watchButton.click(); await sleep((shortestDuration + 5) * 1000); const randomLike = Math.random() <= likeProbability; if (randomLike && likesGiven < maxLikesToGive) { await makeLike(); } watchButton.style.display = 'none'; shortestVideoElement.style.display = 'none'; shortestVideoElement.nextElementSibling.style.display = 'none'; const randomDelay = getRandomDelay(3000, 7000); await sleep(randomDelay); return { duration: shortestDuration }; } } async function watchVideosRecursively(numVideos) { if (videosWatched >= numVideos) { isRunning = false; return; } const videoStat = await watchShortestVideo(); if (videoStat) { videosWatched++; updateStats(); videoStats.push(videoStat); if (videosWatched % 5 === 0) { clearVideoStats(); } await watchVideosRecursively(numVideos); } } function clearVideoStats() { videoStats = []; } // Визуальная часть const squareContainer = createSquareContainer(); document.body.appendChild(squareContainer); const statsTop = createStatsBox('---------------------------------', 'red'); squareContainer.appendChild(statsTop); const videosWatchedStat = createStatBox('Видео просмотрено:', 'black'); squareContainer.appendChild(videosWatchedStat); const likesGivenStat = createStatBox('Лайков поставлено:', 'black'); squareContainer.appendChild(likesGivenStat); const startButton = createButton('Старт', 'yellow', () => { if (!isRunning) { isRunning = true; watchVideosRecursively(numVideosToWatch); } }); squareContainer.appendChild(startButton); const stopButton = createButton('Стоп', 'red', () => { isRunning = false; }); squareContainer.appendChild(stopButton); function createSquareContainer() { const squareContainer = document.createElement('div'); squareContainer.style.position = 'fixed'; squareContainer.style.top = '10px'; squareContainer.style.right = '10px'; squareContainer.style.width = '7cm'; squareContainer.style.height = '5cm'; squareContainer.style.backgroundColor = 'green'; squareContainer.style.border = '1mm solid blue'; return squareContainer; } function createButton(text, color, onClick) { const button = document.createElement('button'); button.textContent = text; button.style.backgroundColor = color; button.style.color = 'black'; button.style.border = '0.2mm solid black'; button.style.fontWeight = 'bold'; button.style.width = '100%'; button.style.marginBottom = '0.3cm'; button.addEventListener('click', onClick); return button; } function createStatsBox(label, color) { const statsBox = document.createElement('div'); statsBox.style.backgroundColor = 'white'; statsBox.style.color = color; statsBox.style.fontWeight = 'bold'; statsBox.style.textAlign = 'center'; statsBox.style.border = '0.5mm solid black'; statsBox.style.marginBottom = '0.3cm'; statsBox.textContent = label; return statsBox; } function createStatBox(label, color) { const statBox = document.createElement('div'); statBox.style.backgroundColor = 'white'; statBox.style.color = color; statBox.style.fontWeight = 'bold'; statBox.style.textAlign = 'center'; statBox.style.border = '0.5mm solid black'; statBox.style.marginBottom = '0.3cm'; statBox.textContent = label + ' 0'; return statBox; } function updateStats() { videosWatchedStat.textContent = 'Видео просмотрено: ' + videosWatched; likesGivenStat.textContent = 'Лайков поставлено: ' + likesGiven; } // Ваши настройки const numVideosToWatch = 49; const maxLikesToGive = 20; const likeProbability = 0.55; })();