Compare commits
10 Commits
7d99c8f6c9
...
febcf2ed9a
Author | SHA1 | Date |
---|---|---|
lingling | febcf2ed9a | |
lingling | bd71f3ac18 | |
lingling | 21776380d3 | |
lingling | 07b66a021d | |
lingling | 1d1789d55c | |
lingling | 499c1bd27c | |
lingling | 95e3a23feb | |
lingling | aa4f2a6b0a | |
lingling | 720df836d2 | |
lingling | 006d6bb027 |
|
@ -1 +1 @@
|
|||
/dist/dist.zip
|
||||
/dist/*
|
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "del ./dist/*;7z a -tzip ./dist/dist.zip ./* '-xr!dist/' '-xr!.vscode/' '-xr!.git/'"
|
||||
"command": "cmd /c 'git log --oneline > ./README.txt';$currentDate = Get-Date -Format 'yyyyMMdd_HHmm';del ./dist/*;7z a -tzip ./dist/dist_$currentDate.zip ./* '-xr!dist/' '-xr!.vscode/' '-xr!.git/'"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
14
README.txt
14
README.txt
|
@ -1,14 +0,0 @@
|
|||
9598f66 提交快速打包脚本
|
||||
bc05112 添加谷歌财经代码但是并没有测试
|
||||
e5e3741 完成谷歌邮箱自动回复邮件功能
|
||||
970c8ba 完成谷歌日历脚本编写
|
||||
28a6a62 修改邮件写法但是还是没办法发送消息
|
||||
b57d8dc 添加忽略的文件夹
|
||||
551f227 完成youto短视频操作
|
||||
7084aed 修改了一部分
|
||||
e4929f6 需要自己修改 脚本 导入进来的脚本都有问题
|
||||
3bec4bf 完成队列和自动关闭的代码实现
|
||||
3faa458 准备更新v3
|
||||
b74e21e 增加一些功能
|
||||
a3125fd 测试
|
||||
a054956 第一次提交
|
76
js/popup.js
76
js/popup.js
|
@ -2,12 +2,18 @@
|
|||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-22 16:22:15
|
||||
* @LastEditTime: 2024-08-26 10:59:53
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
$(function () {
|
||||
// var id = 0, due = ['Dell', ' Lenovo ', "ASUS"], kme = 0 , name="";
|
||||
function shuffleArray(array) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
var id = 0;
|
||||
var name = "";
|
||||
setTimeout(function () {
|
||||
|
@ -50,65 +56,18 @@ $(function () {
|
|||
sendResponse({ name, id });
|
||||
}
|
||||
if (request.ty == "remove") {
|
||||
// chrome.tabs.query({}, function(tabs) {
|
||||
// // 遍历每个标签页并关闭它们
|
||||
// for (var i = 0; i < tabs.length; i++) {
|
||||
// chrome.tabs.remove(tabs[i].id);
|
||||
// }
|
||||
// });
|
||||
chrome.tabs.remove(request.id);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
async function text() {
|
||||
let a = await createTab("https://www.youtube.com/", "youtube");
|
||||
return a;
|
||||
}
|
||||
// async function text2() {
|
||||
// let a= await createTab('https://www.so.com/','360')
|
||||
// return a
|
||||
// }
|
||||
async function youtube_shorts() {
|
||||
let a = await createTab(
|
||||
"https://www.youtube.com/shorts/",
|
||||
"youtube_shorts"
|
||||
);
|
||||
return a;
|
||||
}
|
||||
async function news_google() {
|
||||
let a = await createTab("https://news.google.com/", "news_google");
|
||||
return a;
|
||||
}
|
||||
async function play_google() {
|
||||
let a = await createTab("https://play.google.com/", "play_google");
|
||||
return a;
|
||||
}
|
||||
async function play_finance() {
|
||||
let a = await createTab("https://www.google.com/finance/", "play_finance");
|
||||
return a;
|
||||
}
|
||||
async function mail() {
|
||||
let a = await createTab("https://mail.google.com/mail/", "mail");
|
||||
return a;
|
||||
}
|
||||
async function calendar() {
|
||||
let a = await createTab("https://calendar.google.com/calendar", "calendar");
|
||||
return a;
|
||||
}
|
||||
async function shopping() {
|
||||
let a = await createTab("https://shopping.google.com/", "shopping");
|
||||
return a;
|
||||
}
|
||||
//函数队列
|
||||
let queue = [];
|
||||
queue.push(shopping);
|
||||
queue.push(calendar);
|
||||
queue.push(mail);
|
||||
// queue.push(play_finance);//好像js注入不进去
|
||||
queue.push(play_google);
|
||||
queue.push(news_google);
|
||||
queue.push(youtube_shorts);
|
||||
let queue = [
|
||||
{ url: "https://www.youtube.com/", tip: "youtube" },
|
||||
{ url: "https://news.google.com/", tip: "news_google" },
|
||||
{ url: "https://shopping.google.com/", tip: "shopping" },
|
||||
{ url: "https://play.google.com/", tip: "play_google" },
|
||||
];
|
||||
|
||||
//当前执行的队列索引
|
||||
let closed_index = 0;
|
||||
|
||||
|
@ -122,9 +81,10 @@ $(function () {
|
|||
|
||||
// 浏览器监听事件 关闭标签页时就会执行
|
||||
chrome.tabs.onRemoved.addListener(async (windowId) => {
|
||||
console.log("Closed window: " + windowId);
|
||||
if (closed_index < queue.length) {
|
||||
let tmp = await queue[closed_index]();
|
||||
let url = queue[closed_index].url;
|
||||
let tip = queue[closed_index].tip;
|
||||
let tmp = await createTab(url, tip);
|
||||
// console.log(tmp)
|
||||
sendMsg(tmp);
|
||||
closed_index++;
|
||||
|
|
522
lib/content.js
522
lib/content.js
|
@ -1,161 +1,128 @@
|
|||
//延迟函数解决魔鬼定时器问题
|
||||
/**
|
||||
* 阻塞代码运行
|
||||
* @param {*} n 秒数
|
||||
* @returns
|
||||
*/
|
||||
function delay(n) {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(resolve, n * 1000);
|
||||
});
|
||||
}
|
||||
//随机数生成器
|
||||
/**
|
||||
* 随机数生成
|
||||
* @param {*} min 最小值
|
||||
* @param {*} max 最大值
|
||||
* @returns
|
||||
*/
|
||||
function getRandomInt(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
//随机滑动函数
|
||||
/**
|
||||
* 随机滑动函数
|
||||
* @param {*} y 滑动像素 不传递默认随机
|
||||
*/
|
||||
function RandomIntscrollBy(y = 0) {
|
||||
let rand = getRandomInt(100, 600);
|
||||
scrollBy(0, y == 0 ? rand : y);
|
||||
console.log("随机滑动" + rand);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} element html对象
|
||||
* @param {*} direction 操作 down|up|left|right
|
||||
*/
|
||||
|
||||
function triggerSwipeEvent(element, direction) {
|
||||
const touchStart = new Touch({
|
||||
identifier: Date.now(),
|
||||
target: element,
|
||||
clientX: 0,
|
||||
clientY: 0,
|
||||
screenX: 0,
|
||||
screenY: 0,
|
||||
pageX: 0,
|
||||
pageY: 0,
|
||||
});
|
||||
|
||||
const touchEnd = new Touch({
|
||||
identifier: Date.now() + 1,
|
||||
target: element,
|
||||
clientX: direction === "left" ? -100 : direction === "right" ? 100 : 0,
|
||||
clientY: direction === "up" ? -500 : direction === "down" ? 100 : 0,
|
||||
screenX: direction === "left" ? -100 : direction === "right" ? 100 : 0,
|
||||
screenY: direction === "up" ? -500 : direction === "down" ? 100 : 0,
|
||||
pageX: direction === "left" ? -100 : direction === "right" ? 100 : 0,
|
||||
pageY: direction === "up" ? -500 : direction === "down" ? 100 : 0,
|
||||
});
|
||||
|
||||
const touchMove = new Touch({
|
||||
identifier: Date.now() + 2,
|
||||
target: element,
|
||||
clientX: direction === "left" ? -50 : direction === "right" ? 50 : 0,
|
||||
clientY: direction === "up" ? -500 : direction === "down" ? 50 : 0,
|
||||
screenX: direction === "left" ? -50 : direction === "right" ? 50 : 0,
|
||||
screenY: direction === "up" ? -500 : direction === "down" ? 50 : 0,
|
||||
pageX: direction === "left" ? -50 : direction === "right" ? 50 : 0,
|
||||
pageY: direction === "up" ? -500 : direction === "down" ? 50 : 0,
|
||||
});
|
||||
|
||||
const touchStartEvent = new TouchEvent("touchstart", {
|
||||
touches: [touchStart],
|
||||
targetTouches: [touchStart],
|
||||
changedTouches: [touchStart],
|
||||
cancelable: true,
|
||||
bubbles: true,
|
||||
});
|
||||
|
||||
const touchMoveEvent = new TouchEvent("touchmove", {
|
||||
touches: [touchMove],
|
||||
targetTouches: [touchMove],
|
||||
changedTouches: [touchMove],
|
||||
cancelable: true,
|
||||
bubbles: true,
|
||||
});
|
||||
|
||||
const touchEndEvent = new TouchEvent("touchend", {
|
||||
touches: [],
|
||||
targetTouches: [],
|
||||
changedTouches: [touchEnd],
|
||||
cancelable: true,
|
||||
bubbles: true,
|
||||
});
|
||||
|
||||
element.dispatchEvent(touchStartEvent);
|
||||
element.dispatchEvent(touchMoveEvent);
|
||||
element.dispatchEvent(touchEndEvent);
|
||||
}
|
||||
|
||||
//naver使用函数
|
||||
const naver = async (r, id) => {
|
||||
await delay(1);
|
||||
send_close(id);
|
||||
};
|
||||
|
||||
//naver使用函数
|
||||
const sll360 = async (r, id) => {
|
||||
console.log("??360");
|
||||
await delay(3);
|
||||
send_close(id);
|
||||
};
|
||||
|
||||
const baidu = async (r, id) => {
|
||||
console.log("??baidu");
|
||||
await delay(30);
|
||||
send_close(id);
|
||||
};
|
||||
//youto短视频
|
||||
async function youtube_shorts(r, id) {
|
||||
i = 0;
|
||||
// 随机执行次数
|
||||
randTime = Math.floor(Math.random() * 16) + 15;
|
||||
console.log("执行", randTime, "次");
|
||||
|
||||
// 根据次数随机每次观看的时长
|
||||
const list = [];
|
||||
for (let i = 0; i < randTime; i++) {
|
||||
// 生成 1 到 5 之间的随机整数
|
||||
const randomNum = Math.floor(Math.random() * 44) + 5; //44
|
||||
// 将随机数添加到列表中
|
||||
list.push(randomNum * 1000);
|
||||
}
|
||||
console.log("每个视频的观看时长:", list);
|
||||
|
||||
// 首次进入判断是否播放
|
||||
var playing =
|
||||
document.querySelector("div.playing-mode") == null ? false : true;
|
||||
var paused = document.querySelector("div.paused-mode") == null ? false : true;
|
||||
console.log("playing", playing, "paused", paused);
|
||||
if (playing) {
|
||||
console.log("首次进入在播放!");
|
||||
} else {
|
||||
await delay(5);
|
||||
var playButton = document.getElementsByClassName(
|
||||
"ytp-large-play-button ytp-button"
|
||||
)[0];
|
||||
playButton.click();
|
||||
console.log("点击了播放!");
|
||||
}
|
||||
|
||||
// 执行
|
||||
// var dingshiqi_duanshipin = setInterval(() => {
|
||||
// run((randomTime = list[i]));
|
||||
// }, list[i] + 2000);
|
||||
|
||||
while (true) {
|
||||
await run((randomTime = list[i]));
|
||||
// await delay((list[i] + 2000)/1000);
|
||||
}
|
||||
|
||||
// 定义一个执行函数
|
||||
async function run(randomTime) {
|
||||
// 执行randTime次后停止
|
||||
console.log(
|
||||
"总计:",
|
||||
randTime,
|
||||
"次,当前第:",
|
||||
i + 1,
|
||||
"次,观看时长:",
|
||||
randomTime / 1000,
|
||||
"s"
|
||||
);
|
||||
if (i == randTime) {
|
||||
console.log("已经执行", randTime, "次,关闭当前标签页!");
|
||||
// clearInterval(dingshiqi_duanshipin);
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
// 点赞
|
||||
var button = document.querySelector(
|
||||
".yt-spec-button-shape-next--icon-button"
|
||||
);
|
||||
console.log("是否已点赞:", button.getAttribute("aria-pressed"));
|
||||
button.click();
|
||||
|
||||
bao = $("#shorts-inner-container ytd-reel-video-renderer");
|
||||
for (j = 0; j < bao.length; j++) {
|
||||
// 如果是当前正在播放的视频 点赞+订阅
|
||||
if (typeof $(bao[j]).attr("is-active") == "string") {
|
||||
dianzan = $(bao[j]).find("button")[23];
|
||||
dingyue = $(bao[j]).find("button")[20];
|
||||
// 点赞
|
||||
if ($(dianzan).is(".yt-spec-button-shape-next--tonal"))
|
||||
$(dianzan).click();
|
||||
// 订阅
|
||||
if ($(dingyue).is(".yt-spec-button-shape-next--filled"))
|
||||
$(dingyue).click();
|
||||
j = bao.length;
|
||||
/**
|
||||
*
|
||||
* @param {*} str 字符串
|
||||
* @param {*} arr 需要匹配的字符串数组
|
||||
* @returns boole
|
||||
*/
|
||||
function searchStringContainsArrayKeywords(str, arr) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (str.includes(arr[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 下一集 randomTime - 2s
|
||||
await delay(randomTime);
|
||||
$("div #navigation-button-down button").click();
|
||||
console.log("点击了下一个视频");
|
||||
i++;
|
||||
}
|
||||
|
||||
// 定时器
|
||||
let timer = setTimeout(function () {
|
||||
location.reload();
|
||||
console.log("页面长时间无响应");
|
||||
}, 60000); // 设置超时时间为 5 秒钟
|
||||
|
||||
// 在每次页面有响应的时候,清除计时器即可
|
||||
window.addEventListener("click", function () {
|
||||
console.log("页面有响应");
|
||||
// 清除计时器
|
||||
clearTimeout(timer);
|
||||
// 判断是否再播放
|
||||
var playing =
|
||||
document.querySelector("div.playing-mode") == null ? false : true;
|
||||
var paused =
|
||||
document.querySelector("div.paused-mode") == null ? false : true;
|
||||
console.log("播放:", playing, "暂停:", paused);
|
||||
if (playing) {
|
||||
console.log("已播放!");
|
||||
} else {
|
||||
var playButton = document.getElementsByClassName(
|
||||
"ytp-large-play-button ytp-button"
|
||||
)[0];
|
||||
playButton.click();
|
||||
console.log("点击了播放!");
|
||||
}
|
||||
});
|
||||
send_close(id);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 谷歌商城
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function shopping(r, id) {
|
||||
let number = getRandomInt(2, 10);
|
||||
for (let index = 0; index < number; index++) {
|
||||
|
@ -165,49 +132,20 @@ async function shopping(r, id) {
|
|||
send_close(id);
|
||||
}
|
||||
|
||||
async function calendar(r, id) {
|
||||
await delay(3);
|
||||
let number = getRandomInt(2, 5);
|
||||
console.log($);
|
||||
for (let index = 0; index < number; index++) {
|
||||
//上一页
|
||||
// $$('.T5GQA >span')[1].querySelectorAll('button')[0].click()
|
||||
$(".T5GQA > span").eq(1).find("button").eq(0).click();
|
||||
await delay(getRandomInt(2, 5));
|
||||
//今天
|
||||
$(".L09ZLe >div >div >span >div >button").click();
|
||||
await delay(getRandomInt(2, 5));
|
||||
}
|
||||
//下一页
|
||||
$(".T5GQA > span").eq(2).find("button").eq(0).click();
|
||||
await delay(getRandomInt(2, 5));
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 谷歌新闻
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function news_google(r, id) {
|
||||
console.log("加在完成开始等待8秒");
|
||||
//等待五秒怕加载速度过慢
|
||||
await delay(10);
|
||||
console.log("等待8秒完成");
|
||||
//焦点新闻 数量
|
||||
let new_length = $(".KDoq1").length;
|
||||
//点击会创建新标签暂时没办法控制
|
||||
// let rand_new_index=getRandomInt(0,new_length)
|
||||
//点击焦点新闻
|
||||
$("#i10").click();
|
||||
$(".KDoq1")[0].click();
|
||||
// console.log( $("#i10"))
|
||||
// await delay(10);
|
||||
// let the_number_of_swipes = getRandomInt(3, 6);
|
||||
// for (let index = 0; index < the_number_of_swipes; index++) {
|
||||
// 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);
|
||||
await delay(3);
|
||||
//点击完整报道
|
||||
let sum = getRandomInt(10, 50);
|
||||
for (let index = 0; index < sum; index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
send_close(id);
|
||||
}
|
||||
//谷歌商店浏览
|
||||
|
@ -237,188 +175,31 @@ async function play_google(r, id) {
|
|||
send_close(id);
|
||||
}
|
||||
|
||||
async function play_finance(r, id) {
|
||||
let recommended_attention = $(".sbnBtf >li >a");
|
||||
for (
|
||||
let index = 0;
|
||||
index < getRandomInt(0, recommended_attention.length - 1);
|
||||
index++
|
||||
) {
|
||||
recommended_attention[index].click();
|
||||
await delay(getRandomInt(5, 10));
|
||||
for (let indexx = 0; indexx < getRandomInt(0, 5); indexx++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
//返回主页
|
||||
$(".gb_Bc >a").click();
|
||||
}
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
async function mail(r, id) {
|
||||
let emailReply = [
|
||||
"우리 실장님이 승진을 축하하기 위해서 다음주 금요일에 (1월 21일에) 오후 5시에 XX 호텔에서 회식이 있습니다 첨부 파일에서 구체적이 정보을 참고하세요. ",
|
||||
"회장님의 회의 잘료을 준비위해서 16년에 상품 기획부의 목표 달성 상황을 필요합니다. 다음주 화요일전에 첨부 파일에 형식으로 준비 됬으면 좋겠습니다.많이 감사 드립니다",
|
||||
"좋은 하루 지내세요.",
|
||||
"연휴에 잘 지내세요.",
|
||||
"감사합니다",
|
||||
"이번주의 판매 보고을 보내드립니다. 세해 세일때문에 판매 목표를 잘 달성했슴니다. 첨부 파일을 참고하세요. ",
|
||||
"좋습니다 좋아요",
|
||||
"안녕하세요",
|
||||
"좋습니다",
|
||||
"좋아요",
|
||||
"화이팅",
|
||||
"모르겠습니다",
|
||||
"모르지만 해도 좋아요",
|
||||
"저는 동현 입니다",
|
||||
"해도 좋습니까?",
|
||||
"괜찮아요?",
|
||||
"몇살이에요?",
|
||||
"감사합니다",
|
||||
"미안합니다",
|
||||
"저 갑니다",
|
||||
"사랑해요",
|
||||
];
|
||||
await delay(8);
|
||||
let mails = document.querySelectorAll(".zA");
|
||||
for (let index = 0; index < mails.length; index++) {
|
||||
//挨个查看
|
||||
mails[index].click();
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(1, 5));
|
||||
//邮箱回复
|
||||
if (getRandomInt(0, 1) == 0) {
|
||||
$(".amn >.ams.bkH").click();
|
||||
await delay(getRandomInt(1, 5));
|
||||
let text = emailReply[getRandomInt(0, emailReply.length - 1)];
|
||||
console.log("注入内容为" + text);
|
||||
// $(".Ar.Au >div >div").html = text;
|
||||
let tmp_ele = $(".Ar.Au >div");
|
||||
$(".Ar.Au >div >div").html(tmp_ele.html(text));
|
||||
await delay(3);
|
||||
$(".dC >div").click();
|
||||
await delay(getRandomInt(1, 5));
|
||||
}
|
||||
//返回
|
||||
$(".aim.ain >div >div >div + div").click();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
async function youtube_shorts2(r, id) {
|
||||
//等待五秒怕加载速度过慢
|
||||
await delay(5);
|
||||
//观看次数
|
||||
let views = getRandomInt(50, 100);
|
||||
for (let index = 0; index < views; index++) {
|
||||
//观看多少秒
|
||||
let watch_time = getRandomInt(10, 20);
|
||||
await delay(getRandomInt(2, 5));
|
||||
//随机暂停播放
|
||||
if (getRandomInt(0, 1) == 0) {
|
||||
$(".video-stream.html5-main-video").click();
|
||||
await delay(getRandomInt(2, 5));
|
||||
$(".video-stream.html5-main-video").click();
|
||||
await delay(watch_time);
|
||||
}
|
||||
|
||||
//点赞
|
||||
if (getRandomInt(0, 5) == 3) {
|
||||
//点赞
|
||||
document.querySelector("#like-button > yt-button-shape > label").click();
|
||||
}
|
||||
if (getRandomInt(0, 5) == 2) {
|
||||
//不爱看
|
||||
document
|
||||
.querySelector("#dislike-button > yt-button-shape > label")
|
||||
.click();
|
||||
}
|
||||
|
||||
//论区操作
|
||||
if (getRandomInt(0, 1) == 0) {
|
||||
//打开评论区
|
||||
$(
|
||||
"#comments-button > ytd-button-renderer > yt-button-shape > label > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__fill"
|
||||
).click();
|
||||
await delay(getRandomInt(5, 15));
|
||||
//随机滑动评论区
|
||||
// RandomIntscrollBy();
|
||||
//关闭评论区
|
||||
$(
|
||||
"#visibility-button > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke"
|
||||
).click();
|
||||
}
|
||||
await delay(getRandomInt(3, 5));
|
||||
//下一个视频
|
||||
$(
|
||||
"#navigation-button-down > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke"
|
||||
).click();
|
||||
for (let index = 0; index < 5; index++) {
|
||||
// 使用示例:
|
||||
// let element = $('.YtShortsCarouselCarouselItem.carousel-item[aria-hidden$="false"]')
|
||||
let element = document.querySelector(
|
||||
".YtShortsCarouselCarouselItem.carousel-item"
|
||||
);
|
||||
triggerSwipeEvent(element, "up"); // 触发向左滑动事件
|
||||
await delay(getRandomInt(10, 30));
|
||||
}
|
||||
//看完关闭窗口
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
async function youtube(r, id) {
|
||||
alert("youto");
|
||||
// 点击长视频观看
|
||||
await delay(10);
|
||||
//点击订阅 如果已经订阅过了就不用点
|
||||
if (
|
||||
await delay(5);
|
||||
$(
|
||||
"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();
|
||||
}
|
||||
|
||||
function ServiceLogin(r, id) {
|
||||
let mkeww = 0,
|
||||
mue = setInterval(function () {
|
||||
if ($("form ul>li img").length) {
|
||||
clearInterval(mue);
|
||||
setTimeout(function () {
|
||||
$("form ul>li img").eq(0)[0].click();
|
||||
}, 1900);
|
||||
} else {
|
||||
mkeww++;
|
||||
if (mkeww > 106) {
|
||||
clearInterval(mue);
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
"#app > div > ytm-browse > ytm-single-column-browse-results-renderer > div > div > ytm-tab-renderer > ytm-rich-grid-renderer > div > div.rich-grid-renderer-contents > ytm-rich-item-renderer:nth-child(2) > ytm-video-with-context-renderer > ytm-media-item > a > ytm-thumbnail-cover > img"
|
||||
).click();
|
||||
await delay(getRandomInt(2000, 3600));
|
||||
//看完关闭窗口
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
|
@ -437,42 +218,23 @@ chrome.runtime.sendMessage(
|
|||
let r = obj.name;
|
||||
let id = obj.id;
|
||||
console.log("传递过来的obj" + JSON.stringify(obj));
|
||||
switch (r) {
|
||||
case "naver":
|
||||
naver(r, id);
|
||||
break;
|
||||
case "360":
|
||||
sll360(r, id);
|
||||
break;
|
||||
case "baidu":
|
||||
baidu(r, id);
|
||||
break;
|
||||
case "youtube":
|
||||
youtube(r, id);
|
||||
break;
|
||||
case "youtube_shorts":
|
||||
youtube_shorts2(r, id);
|
||||
break;
|
||||
case "news_google":
|
||||
news_google(r, id);
|
||||
break;
|
||||
case "play_google":
|
||||
play_google(r, id);
|
||||
break;
|
||||
case "play_finance":
|
||||
play_finance(r, id);
|
||||
break;
|
||||
case "mail":
|
||||
mail(r, id);
|
||||
break;
|
||||
case "calendar":
|
||||
calendar(r, id);
|
||||
break;
|
||||
case "shopping":
|
||||
shopping(r, id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
let functoons = [
|
||||
{ name: "naver", funct: naver },
|
||||
{ name: "youtube", funct: youtube },
|
||||
{ name: "youtube_shorts", funct: youtube_shorts2 },
|
||||
{ name: "news_google", funct: news_google },
|
||||
{ name: "play_google", funct: play_google },
|
||||
{ name: "shopping", funct: shopping },
|
||||
];
|
||||
|
||||
for (let index = 0; index < functoons.length; index++) {
|
||||
// const element = functoons[index];
|
||||
let name=functoons[index].name
|
||||
let funct=functoons[index].funct
|
||||
if(r==name){
|
||||
funct(r,id)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
12
popup.html
12
popup.html
|
@ -1,16 +1,24 @@
|
|||
<!--
|
||||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-22 19:03:16
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\popup.html
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>这是一个测试</title>
|
||||
<title>谷歌养号脚本手机版</title>
|
||||
<link href="css/popup.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="lib/jquery-3.3.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/popup.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 520px;height: 470px;text-align: center;margin: auto;">
|
||||
<h2 style="color: #2159f3;">测试是否成功打开</h2>
|
||||
<h2 style="color: #2159f3;">谷歌养号脚本手机版</h2>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in New Issue