From 551f227d2a5e170ee23d5fc4186aaf1a1e93af1d Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Wed, 21 Aug 2024 13:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90youto=E7=9F=AD=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/popup.js | 4 +-- lib/content.js | 94 ++++++++++---------------------------------------- 2 files changed, 21 insertions(+), 77 deletions(-) diff --git a/js/popup.js b/js/popup.js index 0aa3568..fa1a077 100644 --- a/js/popup.js +++ b/js/popup.js @@ -13,7 +13,7 @@ $(function () { setTimeout(function () { chrome.tabs.create( { - url: "https://www.baidu.com/", + url: "https://www.google.com", }, (e) => { name = "naver"; @@ -78,7 +78,7 @@ $(function () { let queue = []; // queue.push(text2) queue.push(news_google); - // queue.push(text2) + queue.push(text2) //当前执行的队列索引 let closed_index = 0; diff --git a/lib/content.js b/lib/content.js index 65d5b39..a5ae35e 100644 --- a/lib/content.js +++ b/lib/content.js @@ -201,6 +201,9 @@ async function news_google(r, id) { // RandomIntscrollBy(); // await delay(getRandomInt(10, 30)); // } +let x=$(".WwrzSb").length,y=1,shu=parseInt(Math.random() * (x - y + 1) + y); + $(".WwrzSb").eq(shu)[0].click(); + scrollBy(0, 153); send_close(id); } @@ -208,7 +211,7 @@ async function youtube_shorts2(r, id) { //等待五秒怕加载速度过慢 await delay(5); //观看次数 - let views = getRandomInt(5, 10); + let views = getRandomInt(50, 100); for (let index = 0; index < views; index++) { //观看多少秒 let watch_time = getRandomInt(10, 30); @@ -231,13 +234,14 @@ async function youtube_shorts2(r, id) { ).click(); await delay(getRandomInt(3, 5)); //随机滑动评论区 - RandomIntscrollBy(); + // RandomIntscrollBy(); //关闭评论区 $( "#visibility-button > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke" ).click(); } - RandomIntscrollBy(600); + //下一个视频 + $('#navigation-button-down > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke').click() } //看完关闭窗口 send_close(id); @@ -247,79 +251,19 @@ async function youtube(r, id) { alert("youto"); // 点击长视频观看 await delay(10); - wb = Math.round( - Math.random() * $("div #contents ytd-rich-grid-row img").length - ); - if ( - $("div #contents ytd-rich-grid-row img") - .eq(wb) - .is(".yt-core-image--fill-parent-height") - ) - $("div #contents ytd-rich-grid-row img").eq(wb).click(); - else - $("div #contents ytd-rich-grid-row img") - .eq(wb + 1) - .click(); + //点击订阅 如果已经订阅过了就不用点 + if($('div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button').eq(0).is('.yt-spec-button-shape-next--filled')) + $('div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button').eq(0).click(); + // 点赞 + if($('div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button').is('.yt-spec-button-shape-next--tonal')) + $('div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button').eq(0).click(); + + $('button .yt-spec-button-shape-next--size-m').click(); + next_vido=Math.round(Math.random()*$('contents ytd-compact-video-renderer div ytd-thumbnail a').length); + if (next_vido == $('contents ytd-compact-video-renderer div ytd-thumbnail a').length) + next_vido=next_vido-1; + $('#contents ytd-compact-video-renderer div ytd-thumbnail a').eq(next_vido)[0].click(); - sum = 1; - // 循环播放 2分钟执行一次 执行5次后关闭 - var dingshiqi = setInterval(function () { - if (sum == 5) { - clearInterval(dingshiqi); - // 关闭当前窗口的所有标签 - const currentTab = window.location.href; - chrome.tabs.query({ currentWindow: true }, (tabs) => { - tabs.forEach((tab) => { - if (tab.url !== currentTab) { - chrome.tabs.remove(tab.id); - } - }); - }); - } - setTimeout(function () { - //点击订阅 如果已经订阅过了就不用点 - if ( - $( - "div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button" - ) - .eq(0) - .is(".yt-spec-button-shape-next--filled") - ) - $( - "div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button" - ) - .eq(0) - .click(); - // 点赞 - if ( - $( - "div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button" - ).is(".yt-spec-button-shape-next--tonal") - ) - $( - "div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button" - ) - .eq(0) - .click(); - }, 5000); - $("button .yt-spec-button-shape-next--size-m").click(); - next_vido = Math.round( - Math.random() * - $("contents ytd-compact-video-renderer div ytd-thumbnail a").length - ); - if ( - next_vido == - $("contents ytd-compact-video-renderer div ytd-thumbnail a").length - ) - next_vido = next_vido - 1; - $("#contents ytd-compact-video-renderer div ytd-thumbnail a") - .eq(next_vido)[0] - .click(); - sum += 1; - send_close(id); - }, 240000); - // 1200000=20分钟 - // 240000=4分钟 } function ServiceLogin(r, id) {