sd-parse-results

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Parse Current ScienceDirect Results Page

解析当前ScienceDirect结果页面

Extract structured data from an already-open ScienceDirect search results page without navigating.
无需导航,从已打开的ScienceDirect搜索结果页面提取结构化数据。

When to use

使用场景

  • After the user has manually navigated to a search results page
  • When re-parsing results after sorting or filtering changes
  • Called internally by other skills
  • 在用户手动导航至搜索结果页面后使用
  • 在排序或筛选条件变更后重新解析结果时使用
  • 被其他技能内部调用

Steps

步骤

Step 1: Extract results from current page

步骤1:从当前页面提取结果

Use
evaluate_script
(no navigation needed):
javascript
() => {
  // Verify we are on a search results page
  if (!window.location.pathname.includes('/search')) {
    return { error: 'Not on a ScienceDirect search results page.' };
  }

  const items = document.querySelectorAll('li.ResultItem');
  if (items.length === 0) {
    return { error: 'No results found on the current page. The page may still be loading.' };
  }

  const papers = [];
  for (let i = 0; i < items.length; i++) {
    const item = items[i];
    const titleLink = item.querySelector('a.result-list-title-link');
    const journal = item.querySelector('a.subtype-srctitle-link');
    const dateSpans = item.querySelectorAll('.srctitle-date-fields > span');
    const date = dateSpans.length > 1 ? dateSpans[dateSpans.length - 1].textContent.trim() : '';
    const authors = [...item.querySelectorAll('.Authors .author')].map(a => a.textContent.trim());
    const doi = item.getAttribute('data-doi');
    const pii = titleLink?.href?.match(/pii\/(\w+)/)?.[1] || '';
    const articleType = item.querySelector('.article-type')?.textContent?.trim() || '';
    const isOpenAccess = !!item.querySelector('.access-label');
    const checkboxId = item.querySelector('.checkbox-input')?.id || '';

    papers.push({
      rank: i + 1,
      title: titleLink?.textContent?.trim() || '',
      pii, doi: doi || '',
      journal: journal?.textContent?.trim() || '',
      date, authors, articleType, openAccess: isOpenAccess,
      checkboxId,
    });
  }

  const totalText = document.querySelector('.search-body-results-text')?.textContent?.trim() || '';
  const pageInfo = document.querySelector('.Pagination li:first-child')?.textContent?.trim() || '';
  const currentUrl = window.location.href;

  return { papers, totalResults: totalText, pageInfo, currentUrl };
}
使用
evaluate_script
(无需导航):
javascript
() => {
  // Verify we are on a search results page
  if (!window.location.pathname.includes('/search')) {
    return { error: 'Not on a ScienceDirect search results page.' };
  }

  const items = document.querySelectorAll('li.ResultItem');
  if (items.length === 0) {
    return { error: 'No results found on the current page. The page may still be loading.' };
  }

  const papers = [];
  for (let i = 0; i < items.length; i++) {
    const item = items[i];
    const titleLink = item.querySelector('a.result-list-title-link');
    const journal = item.querySelector('a.subtype-srctitle-link');
    const dateSpans = item.querySelectorAll('.srctitle-date-fields > span');
    const date = dateSpans.length > 1 ? dateSpans[dateSpans.length - 1].textContent.trim() : '';
    const authors = [...item.querySelectorAll('.Authors .author')].map(a => a.textContent.trim());
    const doi = item.getAttribute('data-doi');
    const pii = titleLink?.href?.match(/pii\/(\w+)/)?.[1] || '';
    const articleType = item.querySelector('.article-type')?.textContent?.trim() || '';
    const isOpenAccess = !!item.querySelector('.access-label');
    const checkboxId = item.querySelector('.checkbox-input')?.id || '';

    papers.push({
      rank: i + 1,
      title: titleLink?.textContent?.trim() || '',
      pii, doi: doi || '',
      journal: journal?.textContent?.trim() || '',
      date, authors, articleType, openAccess: isOpenAccess,
      checkboxId,
    });
  }

  const totalText = document.querySelector('.search-body-results-text')?.textContent?.trim() || '';
  const pageInfo = document.querySelector('.Pagination li:first-child')?.textContent?.trim() || '';
  const currentUrl = window.location.href;

  return { papers, totalResults: totalText, pageInfo, currentUrl };
}

Step 2: Return structured data

步骤2:返回结构化数据

Return the extracted data. The
checkboxId
field (= PII) is important for batch export and download operations.
返回提取到的数据。
checkboxId
字段(即PII)对于批量导出和下载操作至关重要。

Notes

注意事项

  • This skill uses only 1 tool call (
    evaluate_script
    ).
  • It does NOT navigate — it reads the current page as-is.
  • If results are empty, the page may still be loading; consider adding a wait loop inside the script or retrying after a brief delay.
  • 本技能仅使用1次工具调用(
    evaluate_script
    )。
  • 不会执行导航操作——直接读取当前页面的现有内容。
  • 如果结果为空,可能是页面仍在加载中;可考虑在脚本内添加等待循环,或短暂延迟后重试。