增加youtube函数
This commit is contained in:
parent
1d1789d55c
commit
07b66a021d
15
js/popup.js
15
js/popup.js
|
@ -98,15 +98,20 @@ $(function () {
|
|||
let a = await createTab("https://shopping.google.com/", "shopping");
|
||||
return a;
|
||||
}
|
||||
async function youtube() {
|
||||
let a = await createTab("https://www.youtube.com/", "youtube");
|
||||
return a;
|
||||
}
|
||||
//函数队列
|
||||
let queue = [];
|
||||
// queue.push(play_finance);//好像js注入不进去
|
||||
// queue.push(shopping);
|
||||
// queue.push(calendar);
|
||||
queue.push(shopping);
|
||||
queue.push(calendar);
|
||||
queue.push(mail);
|
||||
// queue.push(play_google);
|
||||
// queue.push(news_google);
|
||||
// queue.push(youtube_shorts);
|
||||
// queue.push(youtube);
|
||||
queue.push(play_google);
|
||||
queue.push(news_google);
|
||||
queue.push(youtube_shorts);
|
||||
//乱序执行 此处有问题
|
||||
// queue=shuffleArray(queue)
|
||||
//当前执行的队列索引
|
||||
|
|
|
@ -98,28 +98,27 @@ async function news_google(r, id) {
|
|||
await delay(3);
|
||||
//点击完整报道
|
||||
try {
|
||||
$('.jKHa4e')[0].click()
|
||||
$(".jKHa4e")[0].click();
|
||||
for (let index = 0; index < getRandomInt(3, 5); index++) {
|
||||
RandomIntscrollBy()
|
||||
await delay(3)
|
||||
RandomIntscrollBy();
|
||||
await delay(3);
|
||||
}
|
||||
let new_array=$('.VDXfz')
|
||||
let new_array_href=[]
|
||||
let new_array = $(".VDXfz");
|
||||
let new_array_href = [];
|
||||
for (let index = 0; index < new_array.length; index++) {
|
||||
const element = new_array[index];
|
||||
console.log(element.getAttribute("href"))
|
||||
let url = element.getAttribute("href").replace(/\./g, '');
|
||||
new_array_href.push(`https://news.google.com${url}`)
|
||||
console.log(element.getAttribute("href"));
|
||||
let url = element.getAttribute("href").replace(/\./g, "");
|
||||
new_array_href.push(`https://news.google.com${url}`);
|
||||
}
|
||||
for (let index = 0; index < new_array_href.length; index++) {
|
||||
const element = new_array_href[index];
|
||||
let a= open(element)
|
||||
await delay(3)
|
||||
a.close()
|
||||
|
||||
let a = open(element);
|
||||
await delay(3);
|
||||
a.close();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.log(error);
|
||||
}
|
||||
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].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) {
|
||||
$(".amn >.ams.bkH").click();
|
||||
|
@ -297,9 +303,8 @@ async function youtube_shorts2(r, id) {
|
|||
}
|
||||
|
||||
async function youtube(r, id) {
|
||||
alert("youto");
|
||||
// 点击长视频观看
|
||||
await delay(10);
|
||||
await delay(5);
|
||||
//点击订阅 如果已经订阅过了就不用点
|
||||
if (
|
||||
$(
|
||||
|
@ -401,6 +406,9 @@ chrome.runtime.sendMessage(
|
|||
case "shopping":
|
||||
shopping(r, id);
|
||||
break;
|
||||
case "youtube":
|
||||
youtube(r, id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue