cnki-advanced-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CNKI Advanced Search (高级检索)

CNKI 高级检索

Perform a filtered search on CNKI using the old-style advanced search interface (only interface with source category checkboxes).
使用旧版高级检索界面(唯一带有来源类别复选框的界面)在CNKI上进行筛选检索。

Arguments

参数说明

$ARGUMENTS
describes the search criteria in natural language. Parse it to identify:
  • Subject keywords (主题) — default field
  • Title keywords (篇名)
  • Keywords (关键词)
  • Author name (作者) — separate field
    #au_1_value1
  • Journal/source (文献来源) — separate field
    #magazine_value1
  • Date range (时间范围) —
    #startYear
    /
    #endYear
  • Source category (来源类别:SCI, EI, 北大核心, CSSCI, CSCD)
$ARGUMENTS
用自然语言描述搜索条件,解析时需识别:
  • 主题关键词 — 默认字段
  • 篇名关键词
  • 关键词
  • 作者姓名 — 独立字段
    #au_1_value1
  • 文献来源/期刊 — 独立字段
    #magazine_value1
  • 时间范围
    #startYear
    /
    #endYear
  • 来源类别:SCI, EI, 北大核心, CSSCI, CSCD

Steps

步骤

1. Navigate

1. 导航至页面

Use
mcp__chrome-devtools__navigate_page
https://kns.cnki.net/kns/AdvSearch?classid=7NS01R8M
调用
mcp__chrome-devtools__navigate_page
→ 访问
https://kns.cnki.net/kns/AdvSearch?classid=7NS01R8M

2. Search + get results (single async evaluate_script)

2. 执行检索并获取结果(单次异步脚本执行)

Replace placeholder values with actual search criteria:
javascript
async () => {
  // --- Config: fill in actual values ---
  const query = "KEYWORDS";          // row 1 search keywords
  const fieldType = "SU";           // SU=主题, TI=篇名, KY=关键词, TKA=篇关摘, AB=摘要
  const query2 = "";                // row 2 keywords (optional, "" to skip)
  const fieldType2 = "KY";          // row 2 field type
  const rowLogic = "AND";           // AND=并且, OR=或者, NOT=不含 (between row 1 and 2)
  const sourceTypes = ["CSSCI"];    // any of: "SCI", "EI", "hx", "CSSCI", "CSCD" ([] = all)
  const startYear = "";             // e.g. "2020" or "" for no limit
  const endYear = "";               // e.g. "2025" or "" for no limit
  const author = "";                // author name or ""
  const journal = "";               // journal name or ""

  // --- Wait for form ---
  await new Promise((r, j) => {
    let n = 0;
    const c = () => { if (document.querySelector('#txt_1_value1')) r(); else if (n++ > 30) j('timeout'); else setTimeout(c, 500); };
    c();
  });

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

  const selects = Array.from(document.querySelectorAll('select')).filter(s => s.offsetParent !== null);

  // --- Source type: uncheck 全部, check targets ---
  if (sourceTypes.length > 0) {
    const gjAll = document.querySelector('#gjAll');
    if (gjAll && gjAll.checked) gjAll.click();
    for (const st of sourceTypes) {
      const cb = document.querySelector('#' + st);
      if (cb && !cb.checked) cb.click();
    }
  }

  // --- Row 1: field type + keyword ---
  selects[0].value = fieldType;
  selects[0].dispatchEvent(new Event('change', { bubbles: true }));
  const input = document.querySelector('#txt_1_value1');
  input.value = query;
  input.dispatchEvent(new Event('input', { bubbles: true }));

  // --- Row 2: field type + keyword (optional) ---
  if (query2) {
    selects[5].value = rowLogic; // row logic: AND/OR/NOT
    selects[5].dispatchEvent(new Event('change', { bubbles: true }));
    selects[6].value = fieldType2;
    selects[6].dispatchEvent(new Event('change', { bubbles: true }));
    const input2 = document.querySelector('#txt_2_value1');
    input2.value = query2;
    input2.dispatchEvent(new Event('input', { bubbles: true }));
  }

  // --- Author (optional) ---
  if (author) {
    const auInput = document.querySelector('#au_1_value1');
    if (auInput) { auInput.value = author; auInput.dispatchEvent(new Event('input', { bubbles: true })); }
  }

  // --- Journal (optional) ---
  if (journal) {
    const magInput = document.querySelector('#magazine_value1');
    if (magInput) { magInput.value = journal; magInput.dispatchEvent(new Event('input', { bubbles: true })); }
  }

  // --- Date range (optional) ---
  if (startYear) { selects[14].value = startYear; selects[14].dispatchEvent(new Event('change', { bubbles: true })); }
  if (endYear) { selects[15].value = endYear; selects[15].dispatchEvent(new Event('change', { bubbles: true })); }

  // --- Submit ---
  document.querySelector('div.search')?.click();

  // Wait for results
  await new Promise((r, j) => {
    let n = 0;
    const c = () => {
      if (document.body.innerText.includes('条结果')) r();
      else if (n++ > 40) j('timeout');
      else setTimeout(c, 500);
    };
    setTimeout(c, 2000);
  });

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

  return {
    query, fieldType, query2, fieldType2, rowLogic,
    sourceTypes, startYear, endYear, author, journal,
    total: document.querySelector('.pagerTitleCell')?.innerText?.match(/([\d,]+)/)?.[1] || '0',
    page: document.querySelector('.countPageMark')?.innerText || '1/1',
    url: location.href
  };
}
将占位符替换为实际搜索条件:
javascript
async () => {
  // --- Config: fill in actual values ---
  const query = "KEYWORDS";          // row 1 search keywords
  const fieldType = "SU";           // SU=主题, TI=篇名, KY=关键词, TKA=篇关摘, AB=摘要
  const query2 = "";                // row 2 keywords (optional, "" to skip)
  const fieldType2 = "KY";          // row 2 field type
  const rowLogic = "AND";           // AND=并且, OR=或者, NOT=不含 (between row 1 and 2)
  const sourceTypes = ["CSSCI"];    // any of: "SCI", "EI", "hx", "CSSCI", "CSCD" ([] = all)
  const startYear = "";             // e.g. "2020" or "" for no limit
  const endYear = "";               // e.g. "2025" or "" for no limit
  const author = "";                // author name or ""
  const journal = "";               // journal name or ""

  // --- Wait for form ---
  await new Promise((r, j) => {
    let n = 0;
    const c = () => { if (document.querySelector('#txt_1_value1')) r(); else if (n++ > 30) j('timeout'); else setTimeout(c, 500); };
    c();
  });

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

  const selects = Array.from(document.querySelectorAll('select')).filter(s => s.offsetParent !== null);

  // --- Source type: uncheck 全部, check targets ---
  if (sourceTypes.length > 0) {
    const gjAll = document.querySelector('#gjAll');
    if (gjAll && gjAll.checked) gjAll.click();
    for (const st of sourceTypes) {
      const cb = document.querySelector('#' + st);
      if (cb && !cb.checked) cb.click();
    }
  }

  // --- Row 1: field type + keyword ---
  selects[0].value = fieldType;
  selects[0].dispatchEvent(new Event('change', { bubbles: true }));
  const input = document.querySelector('#txt_1_value1');
  input.value = query;
  input.dispatchEvent(new Event('input', { bubbles: true }));

  // --- Row 2: field type + keyword (optional) ---
  if (query2) {
    selects[5].value = rowLogic; // row logic: AND/OR/NOT
    selects[5].dispatchEvent(new Event('change', { bubbles: true }));
    selects[6].value = fieldType2;
    selects[6].dispatchEvent(new Event('change', { bubbles: true }));
    const input2 = document.querySelector('#txt_2_value1');
    input2.value = query2;
    input2.dispatchEvent(new Event('input', { bubbles: true }));
  }

  // --- Author (optional) ---
  if (author) {
    const auInput = document.querySelector('#au_1_value1');
    if (auInput) { auInput.value = author; auInput.dispatchEvent(new Event('input', { bubbles: true })); }
  }

  // --- Journal (optional) ---
  if (journal) {
    const magInput = document.querySelector('#magazine_value1');
    if (magInput) { magInput.value = journal; magInput.dispatchEvent(new Event('input', { bubbles: true })); }
  }

  // --- Date range (optional) ---
  if (startYear) { selects[14].value = startYear; selects[14].dispatchEvent(new Event('change', { bubbles: true })); }
  if (endYear) { selects[15].value = endYear; selects[15].dispatchEvent(new Event('change', { bubbles: true })); }

  // --- Submit ---
  document.querySelector('div.search')?.click();

  // Wait for results
  await new Promise((r, j) => {
    let n = 0;
    const c = () => {
      if (document.body.innerText.includes('条结果')) r();
      else if (n++ > 40) j('timeout');
      else setTimeout(c, 500);
    };
    setTimeout(c, 2000);
  });

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

  return {
    query, fieldType, query2, fieldType2, rowLogic,
    sourceTypes, startYear, endYear, author, journal,
    total: document.querySelector('.pagerTitleCell')?.innerText?.match(/([\d,]+)/)?.[1] || '0',
    page: document.querySelector('.countPageMark')?.innerText || '1/1',
    url: location.href
  };
}

3. Report

3. 结果报告

Advanced search: "{query}" ({fieldType}) + source: {sourceTypes} → {total} results.
高级检索:"{query}"({fieldType})+ 来源:{sourceTypes} → {total} 条结果。

Tool calls: 2 (navigate + evaluate_script)

工具调用次数:2次(导航 + 执行脚本)

Verified selectors (old-style interface)

已验证的选择器(旧版界面)

Form fields

表单字段

ElementSelector / Select indexNotes
行1 字段类型
selects[0]
SU=主题, TI=篇名, KY=关键词, TKA=篇关摘, AB=摘要
行1 关键词
#txt_1_value1
main keyword input
行1 行内第二词
#txt_1_value2
same-row AND/OR/NOT with first keyword
行1 行内逻辑
selects[2]
AND=并含, OR=或含, NOT=不含
行间逻辑
selects[5]
AND=并且, OR=或者, NOT=不含
行2 字段类型
selects[6]
same options as row 1
行2 关键词
#txt_2_value1
second row keyword
行2 行内第二词
#txt_2_value2
作者
#au_1_value1
placeholder "中文名/英文名/拼音"
作者单位
#au_1_value2
placeholder "全称/简称/曾用名"
文献来源
#magazine_value1
placeholder "期刊名称/ISSN/CN"
基金
#base_value1
起始年
selects[14]
/
#startYear
<select>
1915-2026
结束年
selects[15]
/
#endYear
<select>
2026-1915
检索按钮
div.search
NOT input/button
元素选择器 / 选择索引说明
行1 字段类型
selects[0]
SU=主题, TI=篇名, KY=关键词, TKA=篇关摘, AB=摘要
行1 关键词
#txt_1_value1
主关键词输入框
行1 行内第二词
#txt_1_value2
与第一个关键词同行的AND/OR/NOT逻辑
行1 行内逻辑
selects[2]
AND=并含, OR=或含, NOT=不含
行间逻辑
selects[5]
AND=并且, OR=或者, NOT=不含
行2 字段类型
selects[6]
选项与行1一致
行2 关键词
#txt_2_value1
第二行关键词输入框
行2 行内第二词
#txt_2_value2
作者
#au_1_value1
占位符“中文名/英文名/拼音”
作者单位
#au_1_value2
占位符“全称/简称/曾用名”
文献来源
#magazine_value1
占位符“期刊名称/ISSN/CN”
基金
#base_value1
起始年
selects[14]
/
#startYear
<select>
可选范围1915-2026
结束年
selects[15]
/
#endYear
<select>
可选范围2026-1915
检索按钮
div.search
注意:不是input/button元素

Source type checkboxes (来源类型)

来源类别复选框

来源Checkbox IDNotes
全部期刊
#gjAll
默认勾选,选其他前需取消
SCI来源期刊
#SCI
value="Y"
EI来源期刊
#EI
value="Y"
北大核心期刊
#hx
value="Y"
CSSCI
#CSSCI
value="Y"
CSCD
#CSCD
value="Y"
Multiple source types can be checked simultaneously (OR logic).
来源复选框ID说明
全部期刊
#gjAll
默认勾选,选择其他来源前需取消勾选
SCI来源期刊
#SCI
value="Y"
EI来源期刊
#EI
value="Y"
北大核心期刊
#hx
value="Y"
CSSCI
#CSSCI
value="Y"
CSCD
#CSCD
value="Y"
可同时勾选多个来源类别(逻辑为或)。

Results

结果页元素

ElementSelectorNotes
Result count
.pagerTitleCell
text "共找到 X 条结果"
Page indicator
.countPageMark
text "1/300"
元素选择器说明
结果总数
.pagerTitleCell
文本格式为“共找到 X 条结果”
页码指示器
.countPageMark
文本格式为“1/300”

Captcha detection

验证码检测

Check
#tcaptcha_transform_dy
element's
getBoundingClientRect().top >= 0
.
检查
#tcaptcha_transform_dy
元素的
getBoundingClientRect().top >= 0

Important Notes

重要注意事项

  • Must use old-style URL (
    kns.cnki.net/kns/AdvSearch
    ). New interface (
    kns8s/AdvSearch
    ) has NO source category checkboxes.
  • The
    classid=7NS01R8M
    parameter ensures the correct form layout loads.
  • Results page is compatible with
    cnki-parse-results
    and
    cnki-navigate-pages
    skills.
  • 必须使用旧版URL (
    kns.cnki.net/kns/AdvSearch
    )。新版界面 (
    kns8s/AdvSearch
    ) 没有来源类别复选框。
  • classid=7NS01R8M
    参数确保加载正确的表单布局。
  • 结果页兼容
    cnki-parse-results
    cnki-navigate-pages
    技能。