Zenohack.com - Sniper
log( Starting snipe for ${task.productUrl} , 'info');
module.exports = { sendDiscord }; routes/api.js const express = require('express'); const router = express.Router(); const Task = require('../models/Task'); const Profile = require('../models/Profile'); const { snipeTask } = require('../services/sniper'); // Create sniper task router.post('/tasks', async (req, res) => { const task = await Task.create(req.body); res.json(task); });
// Get all tasks router.get('/tasks', async (req, res) => { const tasks = await Task.find().populate('profileId'); res.json(tasks); }); Zenohack.com Sniper
// 4. Add to cart await page.click('#add-to-cart'); await page.waitForSelector('.cart-notification', { timeout: 3000 }); log('Item added to cart', 'success');
// 2. Go to product page await page.goto(task.productUrl, { waitUntil: 'networkidle2' }); await page.waitForSelector('.product-price', { timeout: 5000 }); const priceText = await page.$eval('.product-price', el => el.innerText); const price = parseFloat(priceText.replace(/[^0-9.]/g, '')); if (price > task.maxPrice) { throw new Error(`Price ${price} exceeds max ${task.maxPrice}`); } log( Starting snipe for ${task
module.exports = { snipeTask }; const axios = require('axios'); async function sendDiscord(message) { if (!process.env.DISCORD_WEBHOOK_URL) return; await axios.post(process.env.DISCORD_WEBHOOK_URL, { content: message }); }
app.use('/api', require('./routes/api')); app.get('/', (req, res) => res.render('index')); Place order await Promise
// 7. Place order await Promise.all([ page.click('#place-order'), page.waitForNavigation({ waitUntil: 'networkidle2' }) ]);