知识库首页 关键词资料 IMPLEMENTATION_PLAN.md

IMPLEMENTATION PLAN

本地来源:关键词/ahrefs-top-worldwide-2026-07-all/ahrefs-top-games-worldwide-2026-07/IMPLEMENTATION_PLAN.md

Ahrefs Top Games SimilarWeb Export Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Export SimilarWeb keyword and organic landing-page data for the 100 July 2026 Ahrefs Top Games domains into resumable per-domain JSON caches and consolidated CSV files.

Architecture: Extend the existing local SimilarWeb wrapper without changing its existing normalized rows contract by adding detailed_rows for all visible website-keyword table columns. A standalone sequential Python batch runner calls the single-browser API, caches every successful response, retries transient failures, and rebuilds consolidated CSV/summary files from cache after every run.

Tech Stack: Node.js node:test, Express/Puppeteer wrapper, Python 3 standard library (urllib, csv, json, unittest).


Task 1: Preserve every website-keyword table field

Files: - Modify: /Users/project/脚本/similarweb/test/table-extraction.test.js - Modify: /Users/project/脚本/similarweb/server.js

  • [x] Add a failing unit test that builds an 18-cell keyword row and expects normalizeDetailedKeywordTableRows() to return rank, keyword, clicks, click share, signed click change, KD, intent, 28-day traffic, signed traffic change, average volume, CPC, zero-click share, position, position change, top URL, URL count, SERP features, and raw cell text.
  • [x] Run npm test and confirm failure because normalizeDetailedKeywordTableRows is not exported.
  • [x] Add the minimal normalizer and DOM metadata capture (data-automation-value and icon names), then expose detailed_rows beside the existing rows response.
  • [x] Run npm test and confirm all wrapper unit tests pass.

Task 2: Build a resumable 100-domain exporter

Files: - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/test_export_similarweb.py - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/export_similarweb.py

  • [x] Add failing Python tests asserting there are exactly 100 unique ranked domains and that cached detailed keyword/landing-page payloads flatten to stable CSV rows.
  • [x] Run python3 -m unittest -v test_export_similarweb.py and confirm failure because the exporter module does not exist.
  • [x] Implement the fixed domain list, sequential API requests, per-endpoint JSON caches, retry handling, fallback parsing for legacy five-column keyword rows, consolidated CSV writers, error CSV, and summary JSON.
  • [x] Run the Python unit tests and confirm they pass.

Task 3: Execute and verify the export

Files: - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/01_domains.csv - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/02_site_keywords_all.csv - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/03_landing_pages_all.csv - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/errors.csv - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/summary.json - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/raw/site_keywords/*.json - Create: /Users/project/1B/sites/关键词/ahrefs-top-games-worldwide-2026-07/raw/landing_pages/*.json

  • [x] Restart the API so it serves the new detailed_rows response and verify one domain returns 100 keyword rows and 100 landing-page rows.
  • [x] Run python3 export_similarweb.py --timeout 100 --retries 2 --sleep 0.2 and allow cache-based resume if interrupted.
  • [x] Re-run failed domains, then rebuild all aggregate outputs from the complete cache.
  • [x] Verify 100 unique domains, cache counts, success/error counts, aggregate row counts, CSV headers, JSON readability, and spot-check discord.com against the API response.

本文档为站内渲染。原始文件本地路径:saas/source/keywords/关键词-ahrefs-top-worldwide-2026-07-all-ahrefs-top-games-worldw-609061.md(仅本地保留,不入库不部署)