Skill: freemanwangfuhan-coder/noon-product-count (version 1.0.0)

--- name: noon-product-count description: Noon 商品数量统计工具。输入阿拉伯语关键词，在 noon.com 沙特站搜索，返回搜索结果的商品数量。 --- # Noon 商品数量统计工具 ## 功能 使用 Chrome 浏览器自动化，在 noon.com/saudi-ar 搜索阿拉伯语关键词，返回搜索结果的总数量。 ## 使用方法 ### 命令行 ```bash node ~/.openclaw/workspace/skills/noon-product-count/index.js "阿语关键词" ``` ### 示例 ```bash node ~/.openclaw/workspace/skills/noon-product-count/index.js "سماعات بلوتوث" ``` ### 批量搜索 ```bash node ~/.openclaw/workspace/skills/noon-product-count/index.js "سماعات" "بلوتوث" "لاسلكي" ``` ## 输出示例 ``` ============================================================ 🔍 搜索关键词: "سماعات بلوتوث" ============================================================ 📊 商品数量: 28,412 ``` ## 技术说明 - 使用 puppeteer-extra + stealth 反检测 - 自动绕过 reCAPTCHA 验证 - 从页面提取 "X نتائج البحث" 格式的总数量 ## 依赖 - puppeteer-extra - puppeteer-extra-plugin-stealth - puppeteer ## 安装依赖 ```bash cd ~/.openclaw/workspace/skills/noon-product-count npm install puppeteer-extra puppeteer-extra-plugin-stealth puppeteer ```

path: index.js
content: const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());

// 搜索单个关键词的商品数量
async function searchCount(keyword) {
  let browser;
  
  try {
    browser = await puppeteer.launch({
      headless: false,
      args: ['--disable-blink-features=AutomationControlled']
    });
    
    const page = await browser.newPage();
    
    // 先访问主页初始化 session
    console.log('   初始化 session...');
    await page.goto('https://www.noon.com/saudi-ar/', {
      waitUntil: 'domcontentloaded',
      timeout: 90000
    });
    await new Promise(r => setTimeout(r, 10000));
    
    // 再搜索
    const encodedKeyword = encodeURIComponent(keyword.trim());
    const url = 'https://www.noon.com/saudi-ar/search/?q=' + encodedKeyword;
    
    console.log('   访问: ' + url);
    
    await page.goto(url, {
      waitUntil: 'domcontentloaded',
      timeout: 90000
    });
    
    console.log('   等待加载...');
    await new Promise(r => setTimeout(r, 25000));
    
    // 获取页面文本
    const text = await page.evaluate(() => document.body.innerText);
    
    await browser.close();
    
    // 提取数量 - 格式: "1,572 نتائج البحث"
    const match = text.match(/([\d,]+)\s*نتائج/);
    if (match) {
      return match[1].replace(/,/g, '');
    }
    
    return '0';
    
  } catch (error) {
    if (browser) await browser.close();
    return '错误: ' + error.message;
  }
}

// 主程序
const args = process.argv.slice(2);

if (args.length === 0) {
  console.error('用法: node index.js "阿语关键词"');
  console.error('示例: node index.js "سماعات بلوتوث"');
  console.error('批量: node index.js "سماعات" "بلوتوث"');
  process.exit(1);
}

async function main() {
  console.log('============================================================');
  console.log('🔍 Noon 商品数量统计');
  console.log('============================================================\n');
  
  for (const keyword of args) {
    console.log('关键词: ' + keyword);
    
    const count = await searchCount(keyword);
    console.log('📊 商品数量: ' + count);
    console.log('');
  }
}

main();


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)