Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
lingling | 0a8db0ecc0 | |
lingling | 97c552695e | |
lingling | d57fe2b04d | |
lingling | 7a67c00bee | |
lingling | 9003b60c47 | |
lingling | 46fc343e76 |
|
@ -1,3 +1,4 @@
|
|||
0a57ec1 修改任务启动顺序
|
||||
2177638 修改打包逻辑
|
||||
07b66a0 增加youtube函数
|
||||
1d1789d 修复邮箱卡住问题
|
||||
|
|
|
@ -1,4 +1,66 @@
|
|||
setTimeout(function(){
|
||||
chrome.tabs.create({ url: "popup.html" }, function () {
|
||||
})
|
||||
},3500);
|
||||
/*
|
||||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-09-29 14:41:33
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\background.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
//记录谷歌账户
|
||||
let Ggoogle_mail = "";
|
||||
//记录是否有运行权限
|
||||
let executionAuthority = false;
|
||||
//是否查询过
|
||||
let haveYouChecked = false;
|
||||
|
||||
/**
|
||||
* 查看是否有权限运行
|
||||
* @param {*} google_mail 谷歌id
|
||||
*/
|
||||
async function viewPermission(google_mail) {
|
||||
try {
|
||||
let tmp = await axios.post(
|
||||
"http://149.129.107.38:8787/index/queryauthorization",
|
||||
{ google_account: google_mail }
|
||||
);
|
||||
if (tmp.data.code == 200) {
|
||||
executionAuthority = true;
|
||||
Ggoogle_mail = google_mail;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error("Error fetching permission:", error);
|
||||
return false;
|
||||
} finally {
|
||||
haveYouChecked = true; // 保证状态更新,即使出现错误
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听消息
|
||||
* @param {*} req 发送过来的消息
|
||||
* @param {*} sendResponse 返回消息
|
||||
*/
|
||||
chrome.runtime.onMessage.addListener(async (req, sender, sendResponse) => {
|
||||
if (req.ty === "viewPermission") {
|
||||
if (haveYouChecked) {
|
||||
// 如果已经查询过,直接返回权限状态
|
||||
sendResponse(executionAuthority);
|
||||
} else {
|
||||
// 没有查询过,执行异步查询
|
||||
const res = req.info;
|
||||
const data = await viewPermission(res);
|
||||
// const data = true;
|
||||
sendResponse(data); // 异步响应结果
|
||||
}
|
||||
return true; // 保持消息通道开放,等待异步 sendResponse
|
||||
}
|
||||
// 其他消息类型的处理
|
||||
return false; // 关闭通道,表示没有需要处理的异步操作
|
||||
});
|
||||
|
||||
// 启动扩展时自动创建一个新标签页
|
||||
setTimeout(function () {
|
||||
chrome.tabs.create({ url: "popup.html" });
|
||||
}, 3500);
|
||||
|
|
59
js/popup.js
59
js/popup.js
|
@ -2,12 +2,23 @@
|
|||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-26 14:50:09
|
||||
* @LastEditTime: 2024-09-30 09:40:14
|
||||
* @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="";
|
||||
/**
|
||||
* 数组打乱随机执行
|
||||
* @param {*} array
|
||||
* @returns
|
||||
*/
|
||||
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 () {
|
||||
|
@ -39,13 +50,6 @@ $(function () {
|
|||
);
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
// 浏览器监听事件 每当有新页面生成就会执行
|
||||
chrome.runtime.onMessage.addListener(function (
|
||||
request,
|
||||
|
@ -57,9 +61,13 @@ $(function () {
|
|||
sendResponse({ name, id });
|
||||
}
|
||||
if (request.ty == "remove") {
|
||||
chrome.tabs.remove(request.id);
|
||||
chrome.tabs.remove(sender.tab.id);
|
||||
}
|
||||
if (request.ty == "get" || request.ty == "remove") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
//乱序执行 此处有问题
|
||||
|
@ -67,12 +75,13 @@ $(function () {
|
|||
//当前执行的队列索引
|
||||
//函数队列
|
||||
let queue = [
|
||||
{ url: "https://www.youtube.com/shorts/", tip: "youtube_shorts" },
|
||||
{ url: "https://www.google.com", tip: "naver" },
|
||||
// { url: "https://www.youtube.com/shorts/", tip: "youtube_shorts" },
|
||||
// { url: "https://www.youtube.com/watch?v=LZ7DMB6h-hs", tip: "youtube" },
|
||||
{ url: "https://play.google.com/", tip: "play_google" },
|
||||
{ url: "https://shopping.google.com/", tip: "shopping" },
|
||||
{ url: "https://calendar.google.com/calendar", tip: "calendar" },
|
||||
{ url: "https://mail.google.com/mail/", tip: "mail" },
|
||||
// { url: "https://play.google.com/", tip: "play_google" },
|
||||
// { url: "https://shopping.google.com/", tip: "shopping" },
|
||||
// { url: "https://calendar.google.com/calendar", tip: "calendar" },
|
||||
// { url: "https://mail.google.com/mail/", tip: "mail" },
|
||||
// { url: "https://www.google.com/finance/", tip: "play_finance" },
|
||||
];
|
||||
let closed_index = 0;
|
||||
|
@ -101,25 +110,9 @@ $(function () {
|
|||
chrome.tabs.query({}, function (tabs) {
|
||||
// 遍历每个标签页并关闭它们
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
chrome.tabs.remove(tabs[i].id);
|
||||
// chrome.tabs.remove(tabs[i].id);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function sed_cont(id) {
|
||||
let message = {
|
||||
info: "来自popup的情书💌",
|
||||
};
|
||||
chrome.tabs.sendMessage(id, message, (res) => {
|
||||
// console.log("popup=>content");
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
chrome.tabs.onCreated.addListener((e) => {
|
||||
sed_cont(id);
|
||||
console.log(e);
|
||||
console.log("创建了一个新的浏览器窗口");
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
203
lib/content.js
203
lib/content.js
|
@ -30,10 +30,35 @@ function RandomIntscrollBy(y = 0) {
|
|||
console.log("随机滑动" + rand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断打开的浏览器页面是PC端还是移动端
|
||||
* @returns mobile_web:手机,PC:PC
|
||||
*/
|
||||
function is_mobile_web(){
|
||||
return /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false
|
||||
}
|
||||
|
||||
//naver使用函数
|
||||
const all = async (r, id) => {
|
||||
for (let index = 0; index < 10; index++) {
|
||||
await delay(1)
|
||||
console.log(`共等待10秒当前${index+1}秒`)
|
||||
}
|
||||
send_close(id);
|
||||
};
|
||||
|
||||
|
||||
//naver使用函数
|
||||
const naver = async (r, id) => {
|
||||
// await delay(1);
|
||||
send_close(id);
|
||||
let googelid_str = (elements = $(".gb_A.gb_Za.gb_0").attr("aria-label"));
|
||||
const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/;
|
||||
const match = googelid_str.match(emailRegex);
|
||||
const email = match ? match[0] : null;
|
||||
console.log(`email:${email} r:${r} id${id}`)
|
||||
let res = await to_background(email);
|
||||
console.log(`res:${res} emall:${email}`);
|
||||
await delay(10)
|
||||
// send_close(id);
|
||||
};
|
||||
/**
|
||||
*
|
||||
|
@ -322,6 +347,147 @@ async function youtube(r, id) {
|
|||
.click();
|
||||
}
|
||||
|
||||
/**
|
||||
* 谷歌商城手机版
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function shopping_phone(r, id) {
|
||||
let number = getRandomInt(2, 10);
|
||||
for (let index = 0; index < number; index++) {
|
||||
for (let index = 0; index < getRandomInt(2, 5); index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
//获取所有的商品链接
|
||||
let sp = document.getElementsByClassName(
|
||||
"gkQHve RmEs5b zypKDd aKoISd RycMEf"
|
||||
);
|
||||
//触发点击事件
|
||||
sp[getRandomInt(0, sp.length - 1)].click();
|
||||
await delay(getRandomInt(10, 20));
|
||||
//获取关闭按钮
|
||||
let close = document.getElementsByClassName(
|
||||
"ioQ39e wv9iH MjJqGe cd29Sd"
|
||||
)[0];
|
||||
close.click();
|
||||
await delay(getRandomInt(2, 5));
|
||||
}
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 谷歌新闻手机版本
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function news_google_phone(r, id) {
|
||||
//等待五秒怕加载速度过慢
|
||||
await delay(3);
|
||||
//滑动次数
|
||||
let sum = getRandomInt(5, 9);
|
||||
for (let index = 0; index < sum; index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
let news_array = $(".cDgn2c");
|
||||
//随机点击模块
|
||||
news_array[getRandomInt(0, news_array.length - 1)].click();
|
||||
for (let index = 0; index < getRandomInt(3, 8); index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(3, 8));
|
||||
}
|
||||
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}`);
|
||||
}
|
||||
// for (let index = 0; index < new_array_href.length; index++) {
|
||||
//这里只打开4个链接太多了有毒
|
||||
for (let index = 0; index < 4; index++) {
|
||||
const element = new_array_href[index];
|
||||
let a = open(element);
|
||||
// console.log(JSON.stringify(a))
|
||||
await delay(3);
|
||||
a.close();
|
||||
}
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 谷歌商店手机版
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function play_google_phone(r, id) {
|
||||
//等待五秒怕加载速度过慢
|
||||
await delay(5);
|
||||
//滑动次数
|
||||
let a = getRandomInt(3, 5);
|
||||
for (let index = 0; index < a; index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(0, 5));
|
||||
}
|
||||
|
||||
//热门游戏随机列表 直接触发点击事件就行
|
||||
let popular_games = document.querySelectorAll("a.Si6A0c.itIJzb");
|
||||
for (let index = 0; index < getRandomInt(3, 5); index++) {
|
||||
try {
|
||||
popular_games[getRandomInt(0, popular_games.length - 1)].click();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
let a = getRandomInt(3, 5);
|
||||
for (let index = 0; index < a; index++) {
|
||||
RandomIntscrollBy();
|
||||
await delay(getRandomInt(0, 5));
|
||||
}
|
||||
$(".f0UV3d").click();
|
||||
await delay(getRandomInt(5, 10));
|
||||
}
|
||||
await delay(getRandomInt(5, 10));
|
||||
//
|
||||
send_close(id);
|
||||
}
|
||||
/**
|
||||
* youtube手机版本
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
async function youtube(r, id) {
|
||||
async function whict() {
|
||||
await delay(5);
|
||||
for (let index = 0; index < getRandomInt(5, 10); index++) {
|
||||
RandomIntscrollBy();
|
||||
}
|
||||
let all_video = $(".media-item-thumbnail-container");
|
||||
all_video[getRandomInt(0, all_video.length - 1)].click();
|
||||
// if(getRandomInt(0,1)==0){
|
||||
// //点赞
|
||||
// document.getElementsByClassName('yt-spec-touch-feedback-shape__fill')[3].click()
|
||||
// //订阅
|
||||
// document.getElementsByClassName('yt-spec-touch-feedback-shape__fill')[2].click()
|
||||
// }
|
||||
await delay(getRandomInt(300, 1800));
|
||||
}
|
||||
for (let index = 0; index < getRandomInt(5, 10); index++) {
|
||||
await whict();
|
||||
}
|
||||
//看完关闭窗口
|
||||
send_close(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不知道什么东西
|
||||
* @param {*} r
|
||||
* @param {*} id
|
||||
*/
|
||||
function ServiceLogin(r, id) {
|
||||
let mkeww = 0,
|
||||
mue = setInterval(function () {
|
||||
|
@ -346,12 +512,35 @@ function send_close(id) {
|
|||
id: id,
|
||||
});
|
||||
}
|
||||
async function to_background(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chrome.runtime.sendMessage(
|
||||
{
|
||||
info: params,
|
||||
ty: "viewPermission",
|
||||
},
|
||||
(res) => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
resolve(res);
|
||||
} else {
|
||||
reject(new Error("No response from background script"));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
chrome.runtime.sendMessage(
|
||||
{
|
||||
ty: "get",
|
||||
},
|
||||
function (obj) {
|
||||
if(obj){
|
||||
|
||||
}else{
|
||||
return
|
||||
}
|
||||
let r = obj.name;
|
||||
let id = obj.id;
|
||||
console.log("传递过来的obj" + JSON.stringify(obj));
|
||||
|
@ -361,7 +550,7 @@ chrome.runtime.sendMessage(
|
|||
{ name: "youtube_shorts", funct: youtube_shorts2 },
|
||||
{ name: "news_google", funct: news_google },
|
||||
{ name: "play_google", funct: play_google },
|
||||
{ name: "play_finance", funct: play_finance },
|
||||
// { name: "play_finance", funct: play_finance },
|
||||
{ name: "mail", funct: mail },
|
||||
{ name: "calendar", funct: calendar },
|
||||
{ name: "shopping", funct: shopping },
|
||||
|
@ -376,9 +565,9 @@ chrome.runtime.sendMessage(
|
|||
funct(r, id);
|
||||
}
|
||||
}
|
||||
if(!is_Match){
|
||||
all(r,id)
|
||||
}
|
||||
}
|
||||
);
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log(request);
|
||||
sendResponse("我收到了你的情书,popup~");
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"128": "icon64.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": ["lib/jquery-3.3.1.min.js","js/background.js"]
|
||||
"scripts": ["lib/jquery-3.3.1.min.js","lib/axios.min.js","js/background.js"]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
|||
"<all_urls>"
|
||||
],
|
||||
"js": [
|
||||
"lib/axios.min.js",
|
||||
"lib/jquery-3.3.1.min.js",
|
||||
"lib/content.js"
|
||||
],
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-22 19:03:16
|
||||
* @LastEditTime: 2024-09-24 14:55:12
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\popup.html
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
|
|
Loading…
Reference in New Issue