监控闲鱼个人卖家:诺瓦 Appia 意大利商用咖啡机,自动刷新+上新提醒
Ce script ne devrait pas être installé directement. C'est une librairie créée pour d'autres scripts. Elle doit être inclus avec la commande // @require https://updategf.qytechs.cn/scripts/571680/1785689/%E9%97%B2%E9%B1%BC%E5%95%86%E7%94%A8%E5%92%96%E5%95%A1%E6%9C%BA%E7%9B%91%E6%8E%A7%28%E4%BB%85%E4%B8%AA%E4%BA%BA%E5%8D%96%E5%AE%B6%29.js
// ==UserScript==
// @name 闲鱼商用咖啡机监控(仅个人卖家)
// @namespace https://greasyfork.org/
// @version 1.0
// @description 监控闲鱼个人卖家:诺瓦 Appia 意大利商用咖啡机,自动刷新+上新提醒
// @author white ss
// @match *://s.2.taobao.com/*
// @grant GM_notification
// @grant GM_addStyle
// @run-at document-end
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const KEYWORDS = ['诺瓦', 'appia', 'Appia', 'APPIA', '咖啡机', '商用', '意大利', '咖啡店'];
const REFRESH_SEC = 30;
const ALARM_URL = 'https://assets.mixkit.co/sfx/preview/mixkit-software-interface-start-2574.mp3';
let notifiedIds = new Set();
let isFirstLoad = true;
let running = true;
GM_addStyle(`
#xy-coffee-monitor{position:fixed;top:10px;right:10px;background:#fff;padding:10px 14px;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:999999;font-size:14px;}
#xy-coffee-monitor button{margin-left:8px;padding:4px 8px;background:#ff6a00;color:#fff;border:none;border-radius:4px;cursor:pointer;}
`);
const panel = document.createElement('div');
panel.id = 'xy-coffee-monitor';
panel.innerHTML = `咖啡机监控(仅个人) 暂停`;
document.body.appendChild(panel);
document.getElementById('xy-toggle').onclick = () => {
running = !running;
panel.innerHTML = running
? '咖啡机监控(仅个人) 暂停'
: '已暂停 继续';
};
function playAlert() {
const audio = new Audio(ALARM_URL);
audio.volume = 0.7;
audio.play().catch(() => {});
}
function isPersonalSeller(el) {
const text = el.textContent || '';
return /个人|个人卖家|个人闲置|自用/.test(text) && !/商家|店铺|批发|回收|租赁/.test(text);
}
function titleMatch(title) {
if (!title) return false;
return KEYWORDS.some(k => title.includes(k));
}
function scanItems() {
const items = [];
document.querySelectorAll('.item-wrapper').forEach(el => {
const id = el.dataset.id;
const title = el.querySelector('.item-title')?.textContent?.trim() || '';
const sellerEl = el.querySelector('.seller-type, .user-type');
if (id && titleMatch(title) && sellerEl && isPersonalSeller(sellerEl)) {
items.push({ id, title });
}
});
return items;
}
function checkNewItems() {
if (!running) return;
const items = scanItems();
if (isFirstLoad) {
items.forEach(i => notifiedIds.add(i.id));
isFirstLoad = false;
return;
}
let hasNew = false;
items.forEach(item => {
if (!notifiedIds.has(item.id)) {
notifiedIds.add(item.id);
hasNew = true;
}
});
if (hasNew) {
playAlert();
GM_notification({
title: "个人卖家上新!",
text: "诺瓦/Appia/商用咖啡机",
timeout: 10000
});
}
}
setInterval(() => {
if (running) location.reload();
}, REFRESH_SEC * 1000);
window.addEventListener('load', () => {
setTimeout(checkNewItems, 2000);
});
})();