增加youtube函数

This commit is contained in:
lingling 2024-08-26 14:34:55 +08:00
parent 1d1789d55c
commit 07b66a021d
2 changed files with 53 additions and 40 deletions

View File

@ -98,15 +98,20 @@ $(function () {
let a = await createTab("https://shopping.google.com/", "shopping"); let a = await createTab("https://shopping.google.com/", "shopping");
return a; return a;
} }
async function youtube() {
let a = await createTab("https://www.youtube.com/", "youtube");
return a;
}
//函数队列 //函数队列
let queue = []; let queue = [];
// queue.push(play_finance);//好像js注入不进去 // queue.push(play_finance);//好像js注入不进去
// queue.push(shopping); queue.push(shopping);
// queue.push(calendar); queue.push(calendar);
queue.push(mail); queue.push(mail);
// queue.push(play_google); // queue.push(youtube);
// queue.push(news_google); queue.push(play_google);
// queue.push(youtube_shorts); queue.push(news_google);
queue.push(youtube_shorts);
//乱序执行 此处有问题 //乱序执行 此处有问题
// queue=shuffleArray(queue) // queue=shuffleArray(queue)
//当前执行的队列索引 //当前执行的队列索引

View File

@ -98,28 +98,27 @@ async function news_google(r, id) {
await delay(3); await delay(3);
//点击完整报道 //点击完整报道
try { try {
$('.jKHa4e')[0].click() $(".jKHa4e")[0].click();
for (let index = 0; index < getRandomInt(3, 5); index++) { for (let index = 0; index < getRandomInt(3, 5); index++) {
RandomIntscrollBy() RandomIntscrollBy();
await delay(3) await delay(3);
} }
let new_array=$('.VDXfz') let new_array = $(".VDXfz");
let new_array_href=[] let new_array_href = [];
for (let index = 0; index < new_array.length; index++) { for (let index = 0; index < new_array.length; index++) {
const element = new_array[index]; const element = new_array[index];
console.log(element.getAttribute("href")) console.log(element.getAttribute("href"));
let url = element.getAttribute("href").replace(/\./g, ''); let url = element.getAttribute("href").replace(/\./g, "");
new_array_href.push(`https://news.google.com${url}`) new_array_href.push(`https://news.google.com${url}`);
} }
for (let index = 0; index < new_array_href.length; index++) { for (let index = 0; index < new_array_href.length; index++) {
const element = new_array_href[index]; const element = new_array_href[index];
let a= open(element) let a = open(element);
await delay(3) await delay(3);
a.close() a.close();
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error);
} }
send_close(id); send_close(id);
} }
@ -216,13 +215,20 @@ async function mail(r, id) {
// console.log(mails_is_google[index].getElementsByClassName('yX xY')[0].children[1].children[0].children[0].getAttribute("email")) // console.log(mails_is_google[index].getElementsByClassName('yX xY')[0].children[1].children[0].children[0].getAttribute("email"))
// console.log(mails_is_google[index].children[4].children[1].children[0].children[0].getAttribute("email")) // console.log(mails_is_google[index].children[4].children[1].children[0].children[0].getAttribute("email"))
//获取邮件发送人 //获取邮件发送人
let mail_for = mails_is_google[index].getElementsByClassName('yX xY')[0].children[1].children[0].children[0].getAttribute("email") let mail_for = mails_is_google[index]
.getElementsByClassName("yX xY")[0]
.children[1].children[0].children[0].getAttribute("email");
//是否回复 //是否回复
let whether_or_not_to_reply_to= searchStringContainsArrayKeywords(mail_for,['google','youtube','gbcloud']) let whether_or_not_to_reply_to = searchStringContainsArrayKeywords(
mail_for,
["google", "youtube", "gbcloud"]
);
//逻辑取反 //逻辑取反
whether_or_not_to_reply_to=!whether_or_not_to_reply_to whether_or_not_to_reply_to = !whether_or_not_to_reply_to;
console.log(`当前邮件发送人:${mail_for} 是否回复${whether_or_not_to_reply_to}`) console.log(
`当前邮件发送人:${mail_for} 是否回复${whether_or_not_to_reply_to}`
);
//邮箱回复 //邮箱回复
if (getRandomInt(0, 1) == 0 && whether_or_not_to_reply_to) { if (getRandomInt(0, 1) == 0 && whether_or_not_to_reply_to) {
$(".amn >.ams.bkH").click(); $(".amn >.ams.bkH").click();
@ -297,9 +303,8 @@ async function youtube_shorts2(r, id) {
} }
async function youtube(r, id) { async function youtube(r, id) {
alert("youto");
// 点击长视频观看 // 点击长视频观看
await delay(10); await delay(5);
//点击订阅 如果已经订阅过了就不用点 //点击订阅 如果已经订阅过了就不用点
if ( if (
$( $(
@ -401,6 +406,9 @@ chrome.runtime.sendMessage(
case "shopping": case "shopping":
shopping(r, id); shopping(r, id);
break; break;
case "youtube":
youtube(r, id);
break;
default: default:
break; break;
} }