限时秒杀
function startClickingEndButtons() {
// 初始时,点击所有符合条件的按钮
clickNextEndButton();
}
function clickNextEndButton() {
// 获取所有<td>标签中的<a>标签,查找包含"取消活动"字样的<a>标签
const allATags = document.querySelectorAll('td a');
const endTags = [];
// 遍历所有<a>标签,找到包含"取消活动"文本的那个
allATags.forEach(aTag => {
if (aTag.textContent.includes('取消活动')) {
endTags.push(aTag); // 将所有包含"结束"的<a>标签加入endTags数组
}
});
if (endTags.length > 0) {
const nextTag = endTags[0]; // 获取第一个符合条件的标签
console.log('Clicking button with "取消活动" text');
nextTag.click(); // 点击第一个符合条件的<a>标签
// 延迟1秒后点击弹出窗口中的"放弃活动"按钮
setTimeout(() => {
clickPopupButton();
// 延迟2秒再继续点击
setTimeout(() => {
console.log("Waiting for page update...");
// 页面更新后,继续点击下一个符合条件的a标签
clickNextEndButton();
}, 2000); // 页面刷新后等待2秒
}, 300); // 等待1秒,确保弹出窗口显示
} else {
console.log('No more "放弃活动" buttons found');
}
}
// 点击弹出的"确认结束"按钮
function clickPopupButton() {
// 获取所有具有data-testid="beast-core-button"的button标签
const buttons = document.querySelectorAll('button[data-testid="beast-core-button"]');
// 遍历所有按钮,查找包含"放弃活动"文本的按钮
buttons.forEach(button => {
const span = button.querySelector('span');
if (span && span.textContent.includes('放弃活动')) {
console.log('Clicked the confirm end button');
button.click(); // 点击符合条件的按钮
}
});
}
// 启动点击操作
startClickingEndButtons();
首单&限量
function startClickingEndButtons() {
// 初始时,点击所有符合条件的按钮
clickNextEndButton();
}
function clickNextEndButton() {
// 获取所有<td>标签中的<a>标签,查找包含"结束"字样的<a>标签
const allATags = document.querySelectorAll('td a');
const endTags = [];
// 遍历所有<a>标签,找到包含"结束"文本的那个
allATags.forEach(aTag => {
if (aTag.textContent.includes('结束')) {
endTags.push(aTag); // 将所有包含"结束"的<a>标签加入endTags数组
}
});
if (endTags.length > 0) {
const nextTag = endTags[0]; // 获取第一个符合条件的标签
console.log('Clicking button with "结束" text');
nextTag.click(); // 点击第一个符合条件的<a>标签
// 延迟500毫秒后点击弹出窗口中的"确认结束"按钮
setTimeout(() => {
clickPopupButton();
// 延迟2秒再继续点击
setTimeout(() => {
console.log("Waiting for page update...");
// 页面更新后,继续点击下一个符合条件的a标签
clickNextEndButton();
}, 2000); // 页面刷新后等待2秒
}, 500); // 等待500毫秒,确保弹出窗口显示
} else {
console.log('No more "结束" buttons found');
}
}
// 点击弹出的"确认结束"按钮
function clickPopupButton() {
// 获取所有具有data-testid="beast-core-button"的button标签
const buttons = document.querySelectorAll('button[data-testid="beast-core-button"]');
// 遍历所有按钮,查找包含"确认结束"文本的按钮
buttons.forEach(button => {
const span = button.querySelector('span');
if (span && span.textContent.includes('确认结束')) {
console.log('Clicked the confirm end button');
button.click(); // 点击符合条件的按钮
// 继续点击 "直接结束" 按钮
setTimeout(() => {
clickDirectEndButton();
}, 500); // 等待500毫秒,确保 "直接结束" 按钮已加载
}
});
}
// 点击弹出的"直接结束"按钮
function clickDirectEndButton() {
// 获取具有 "直接结束" 文本的<a>标签
const directEndButton = document.querySelector('a[data-tracking-viewid="straight_end_shared"]');
if (directEndButton) {
console.log('Clicked the direct end button');
directEndButton.click(); // 点击 "直接结束" 按钮
} else {
console.log('Direct end button not found');
}
}
// 启动点击操作
startClickingEndButtons();
提取当页ID
// 创建一个函数来提取ID编号并导出为TXT文件
(function () {
// 查找所有包含ID编号的元素
const orderElements = document.querySelectorAll('td');
// 用于存储提取的ID编号
let orderData = '';
orderElements.forEach((element) => {
if (element.innerText.includes('ID')) {
// 使用正则提取ID编号
const match = element.innerText.match(/ID:([\d]+)/);
if (match && match[1]) {
orderData += match[1].trim() + '\n';
}
}
});
if (orderData) {
// 创建一个Blob对象
const blob = new Blob([orderData], { type: 'text/plain' });
// 创建一个下载链接
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'order_numbers.txt';
// 触发下载
document.body.appendChild(link);
link.click();
// 移除下载链接
document.body.removeChild(link);
console.log('ID编号已成功导出为TXT文件');
} else {
console.warn('未找到ID编号');
}
})();
淘宝商品提取
(function () {
// 1. 查找所有表格行(假设数据在<tr>中)
const rows = document.querySelectorAll('tr');
// 2. 存储提取的数据(标题行 + 内容)
let csvContent = '商品ID,商品标题\n'; // CSV表头
rows.forEach(row => {
// 3. 定位第二个<td>(假设每行的第二个单元格)
const targetTd = row.querySelector('td:nth-child(2)');
if (!targetTd) return;
// 4. 提取第一个span(商品标题)
const titleSpan = targetTd.querySelector('span:nth-child(1)');
const title = titleSpan?.innerText.trim() || 'N/A';
// 5. 提取第二个span中的纯数字(商品ID)
const idSpan = targetTd.querySelector('span:nth-child(2)');
const id = idSpan?.innerText.match(/\d+/)?.[0] || 'N/A';
// 6. 生成一行CSV数据(用逗号分隔)
csvContent += `${id},${title}\n`;
});
// 7. 导出CSV文件
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = '商品信息.csv';
link.click();
console.log('CSV文件已生成!');
})();
Comments NOTHING