N.E.K.O: Skill for Claude Code

.agent/skills/ssr-hydration-scraping/SKILL.md

ssr-hydration-scraping is a skill for Claude Code, Codex from Project-N-E-K-O/N.E.K.O. It costs 57 tokens per session (875 once invoked), scanned A, original, Apache-2.0.

A method for extracting data from the hidden JSON state that modern React and Vue websites send with their first page. React and Vue are tools for building web interfaces, while SSR means the server prepares the page before sending it.

In plain words
What is it for?
Use it to scrape Next.js or Nuxt.js pages by finding their embedded data and querying nested fields.
Why use it?
It avoids relying on changing HTML element names and can reach data that is present but not visibly rendered.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

This is Project-N-E-K-O/N.E.K.O's own configuration. It tells Claude Code and Codex how to work on N.E.K.O itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything N.E.K.O configures →

About the project

N.E.K.O is a real-time AI catgirl companion designed to live with the user, initiate interaction, share media, and perform tasks through an emotional engine. It is intended for people seeking a proactive personal digital companion. The catalogue contains skills for working with it.

Project-N-E-K-O/N.E.K.O · 2,829 stars · on GitHub · store.steampowered.com

Reuse

Borrowing it

Nothing to install: this file belongs to Project-N-E-K-O/N.E.K.O. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Project-N-E-K-O/N.E.K.O/main/.agent/skills/ssr-hydration-scraping/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Project-N-E-K-O/N.E.K.O

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ssr-hydration-scraping

README.md
[![agentmods](https://agentmods.dev/badge/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping/github.svg)](https://agentmods.dev/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping)
Your own site
<a href="https://agentmods.dev/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping"><img src="https://agentmods.dev/badge/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ssr-hydration-scraping

Your own site · 80×15
<a href="https://agentmods.dev/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping"><img src="https://agentmods.dev/badge/skills/project-n-e-k-o/n.e.k.o/ssr-hydration-scraping.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 875 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.00875
Opus 5 $0.00028 $0.00438
Sonnet 5 $0.00011 $0.00175
Haiku 4.5 $0.00006 $0.00088

Measured 11d ago against content hash 92fbc92e52f1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

ssr-hydration-scraping scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agent/skills/ssr-hydration-scraping/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SSR Hydration Data Scraping

症状 (Symptoms of Brittle DOM Scraping)

  • 爬虫经常因为前端 CSS Modules 或 Styled Components 的随机 Hash 类名(如 class="sc-fHeRUl")变化而大面积失效。
  • 难以准确遍历 DOM 树内嵌的复杂状态(如下拉加载更多、未渲染的图集等)。

根本原因 (Root Cause)

现代前端框架(React, Vue, Solid)在使用服务端渲染(SSR)时,为了在客户端“注水”(Hydration),通常会将首屏所需的完整甚至包含下一页数据的 JSON 序列化并挂载在 HTML 的 <script> 标签内。 直接提取这段纯净的 JSON 结构比解析混合了展示逻辑的 DOM 要稳定和高效得多。

代码解决方案 (Solution)

1. 定位 SSR 数据块

使用正则表达式全局提取目标脚本标签中的 JSON 字符串。

import re
import json

def extract_ssr_data(html: str) -> dict:
    # Next.js
    next_match = re.search(r'<script id="__NEXT_DATA__" type="application/json">(.*?)</script>', html, re.DOTALL)
    # Nuxt.js / Vue
    nuxt_match = re.search(r'window\.__NUXT__\s*=\s*({.*?});', html, re.DOTALL)
    # 通用 Initial State
    init_match = re.search(r'window\.__INITIAL_STATE__\s*=\s*({.*?});', html, re.DOTALL)

    if next_match:
        return json.loads(next_match.group(1))
    elif nuxt_match:
        return json.loads(nuxt_match.group(1))
    elif init_match:
        return json.loads(init_match.group(1))
    return {}

2. 使用 jmespath 结构化查询规避多层嵌套校验

SSR 数据常有极深的组件树嵌套,直接使用字典 .get() 或递归极易出错或遗漏。推荐使用 jmespath 进行路径嗅探:

import jmespath

ssr_data = extract_ssr_data(html)
if ssr_data:
    # 使用 jmespath 嗅探可能的列表挂载点
    possible_paths = [
        "props.pageProps.data.rows",
        "props.pageProps.list",
        "payload.data[0].list"
    ]
    target_list = []
    for path in possible_paths:
        res = jmespath.search(path, ssr_data)
        if isinstance(res, list) and len(res) > 0:
            target_list = res
            break
            
    # 遍历干净的数据对象
    for item in target_list:
        print(item.get('url'), item.get('title'))

关键经验 (Key Takeaways)

  1. 停止在 DOM 树里捡垃圾:面对现代网站抓取任务,F12 后第一件事是全局搜索目标文本,查看是否直接躺在某个 <script>window.xxx 的 JSON 赋值里。
  2. 容错性:使用 jmespath 可以跨越层级查找,极大地提升了针对未知嵌套结构的防御力。
  3. 退路:如果 SSR 没有数据,不要立刻写 DOM 抓取,先抓包看是否有页面渲染初期的直连 XHR API,走 XHR API("结构化白嫖")同样远优于 DOM 解析。

Read the full file on GitHub · 70 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 70 lines · 57 tokens per session scan A 92fbc92e52f1

Subscribe to this mod's changes

ssr-hydration-scraping is a skill published in the GitHub repository Project-N-E-K-O/N.E.K.O (2,829 stars, last pushed yesterday), licensed Apache-2.0. It adds 57 tokens to every session and 875 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.