# Cnki Navigate Pages

Navigate CNKI search result pages (next/previous/specific page) or change sort order.

- Repository: https://github.com/cookjohn/cnki-skills (1031 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-03-13
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add cookjohn/cnki-skills --skill cnki-navigate-pages -g -a claude-code -y`
Codex: `npx skills add cookjohn/cnki-skills --skill cnki-navigate-pages -g -a codex -y`
Cursor: `npx skills add cookjohn/cnki-skills --skill cnki-navigate-pages -g -a cursor -y`
Gemini CLI: `npx skills add cookjohn/cnki-skills --skill cnki-navigate-pages -g -a gemini-cli -y`

## Description

Navigate CNKI search result pages (next/previous/specific page) or change sort order. Use when user wants to see more results or change sorting.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CNKI Results Pagination and Sorting

All operations use a single async `evaluate_script`, no snapshot or wait_for needed.

## Arguments

`$ARGUMENTS` should be one of:
- `next` / `previous` / `page N`, pagination
- `sort by date` / `sort by citations` / `sort by downloads` / `sort by relevance` / `sort by comprehensive`, sorting

## Pagination (single evaluate_script)

Replace `ACTION_HERE` with `"next"`, `"previous"`, or `"page 3"`:

```javascript
async () => {
  const cap = document.querySelector('#tcaptcha_transform_dy');
  if (cap && cap.getBoundingClientRect().top >= 0) return { error: 'captcha' };

  const action = "ACTION_HERE";
  const pageLinks = document.querySelectorAll('.pages a');
  const prevMark = document.querySelector('.countPageMark')?.innerText;

  if (action === 'next') {
    const next = Array.from(pageLinks).find(a => a.innerText.trim() === '下一页');
    if (!next) return { error: 'no_next_page' };
    next.click();
  } else if (action === 'previous') {
    const prev = Array.from(pageLinks).find(a => a.innerText.trim() === '上一页');
    if (!prev) return { error: 'no_previous_page' };
    prev.click();
  } else {
    const num = action.replace(/\D/g, '');
    const target = Array.from(pageLinks).find(a => a.innerText.trim() === num);
    if (!target) return { error: 'page_not_found', available: Array.from(pageLinks).map(a => a.innerText.trim()) };
    target.click();
  }

  // Wait for page change
  await new Promise((r, j) => {
    let n = 0;
    const c = () => {
      const mark = document.querySelector('.countPageMark')?.innerText;
      if (mark && mark !== prevMark) r();
      else if (++n > 30) j('timeout');
      else setTimeout(c, 500);
    };
    setTimeout(c, 1000);
  });

  const cap2 = document.querySelector('#tcaptcha_transform_dy');
  if (cap2 && cap2.getBoundingClientRect().top >= 0) return { error: 'captcha' };

The rest: https://github.com/cookjohn/cnki-skills/blob/HEAD/skills/cnki-navigate-pages/SKILL.md
