Logo de Zju Literature Downloader

Zju Literature Downloader

Comunidade
baihe26
zju-literature-downloader

Use esta habilidade sempre que o usuário quiser usar a própria sessão autenticada da Zhejiang University Library, WebVPN, CAS SSO, 求是学术搜索, Summon, ScienceDirect, de uma editora ou do Chrome para pesquisar, baixar, organizar, tentar novamente e ler PDFs acadêmicos e materiais complementares legalmente. Acione esta habilidade em pedidos como “baixar artigos pela biblioteca da Zhejiang University”, “baixar PDF pelo WebVPN”, “tentar baixar novamente após falha na autenticação CAS”, “continuar após a verificação humana do ScienceDirect”, “baixar materiais complementares automaticamente”, “ler o texto completo e os materiais complementares”, “organizar artigos em lote na pasta do projeto” ou “ler o texto completo depois de importar para o Zotero”.

Add to TypingMind

Visão geral

Publicado porbaihe26
Repositóriozju-literature-downloader
Nome da habilidadezju-literature-downloader
Estrelas
36
Forks
3
Arquivos incluídos
9
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 9

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por baihe26 no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Zju Literature Downloader no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/baihe26/zju-literature-downloader/tree/main
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/baihe26/zju-literature-downloader.git \
  .claude/skills/zju-literature-downloader
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Zju Literature Downloader em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Zju Literature Downloader automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Zju Literature Downloader não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

ZJU Literature Downloader

This skill turns the verified workflow into a repeatable, legally scoped process for finding, downloading, and reading papers through the user's Zhejiang University Library / WebVPN access.

Boundaries

Use only the user's legitimate institutional access. Do not bypass paywalls, DRM, CAPTCHA, Cloudflare, publisher bot checks, or two-factor authentication. If a page asks for CAPTCHA, QR login, SMS/OTP, Cloudflare, publisher bot checks, or a security challenge, stop and ask the user to complete it in Chrome.

Avoid mass downloading. Work in small batches, preferably after the user confirms the paper list. Leave a clear audit trail of what was downloaded, from where, and whether supporting information was found.

Do not ask the user to paste institutional passwords, CAS credentials, OTP codes, recovery codes, or session tokens into chat or terminal. If the user offers a password, decline and use the handoff-login workflow instead.

Exception for ZJU CAS saved-login pages: if the user explicitly says that Chrome has already filled the ZJU CAS credentials and authorizes clicking the login/confirm button, the agent may click that button once on the ZJU CAS/WebVPN/institutional SSO page without reading, copying, or typing any credential. This exception does not apply to CAPTCHA, QR login, SMS/OTP, publisher bot checks, or any page outside the expected institutional login flow.

Do not inspect or export cookies, passwords, local storage, browser profiles, or session files. Use the browser's already-authenticated page context only.

Capability Check Before Downloads

For a resumed batch, a stalled PDF, an unavailable control tool, or a View PDF redirect loop, first read references/browser-download-recovery.md. Establish current capabilities before requesting repeated user action.

The following describes the existing Chrome/CDP-proxy route, not universal prerequisites. Prefer the host's supported browser/download tools when they can use the user's authorized session and chosen destination. Do not install or expose a debugging endpoint just because this checklist mentions one.

For the Chrome/CDP-proxy route, confirm these conditions:

  1. Chrome is open on the user's machine.
  2. The user has personally logged in to Zhejiang University Library / WebVPN in Chrome.
    • Common pages: https://libweb.zju.edu.cn/, https://webvpn.zju.edu.cn/, https://zju.summon.serialssolutions.com/.
  3. Chrome remote debugging is allowed for the current browser instance.
    • Ask the user to open chrome://inspect/#remote-debugging.
    • They must enable Allow remote debugging for this browser instance.
  4. The environment can run Node.js 22+.
    • Try node --version.
    • If node is not on PATH in Codex Desktop, try %LOCALAPPDATA%\OpenAI\Codex\bin\node.exe.
  5. The web-access CDP proxy is available or can be started.
    • Typical Claude Code path: %USERPROFILE%\.claude\skills\web-access-main\scripts\check-deps.mjs.
    • Typical shared agent path: %USERPROFILE%\.agents\skills\web-access-main\scripts\check-deps.mjs.
    • In Codex-only setups also check %USERPROFILE%\.codex\skills\web-access-main\scripts\check-deps.mjs.
  6. The user has approved the target output folder.

If Claude Code says this skill is not installed, install or copy it to:

powershell
$env:USERPROFILE\.claude\skills\zju-literature-downloader

Codex and other agent setups may instead use .codex\skills or .agents\skills; treat the three locations as install targets, not as different skill versions.

Batch Scope

Small batches are supported when the user provides a definite DOI/title/PMID list.

Recommended limits:

  • normal batch: 5-10 papers
  • upper practical batch: 15-20 papers, with pauses and a manifest
  • stop immediately if publisher checks, CAPTCHA, WebVPN expiry, or unusual download prompts appear

Do not turn a broad keyword search into unlimited automatic downloading. Do not download whole journal issues, volumes, or large result sets.

Status Categories

Classify every paper into one of these statuses, and keep the status in the manifest:

text
downloaded
downloaded_with_si
si_only_downloaded
pdf_loading
pdf_visible_unsaved
saved_pending_verification
identity_mismatch
browser_control_unavailable
host_execution_denied
cas_waiting_user
institutional_login_waiting_user
cas_resolved_retry_needed
publisher_verification_waiting_user
sciencedirect_robot_check
retry_after_user_verification
do_not_auto_retry
url_needs_repair
summon_no_link
summon_unreachable
browser_pdf_viewer_fallback_needed
publisher_blocked_waiting_user
no_authorized_pdf_found
failed_after_retry
ip_not_authorized
purchase_required

Use cas_waiting_user when the browser is visibly at Zhejiang University CAS / unified identity authentication. Use institutional_login_waiting_user when the paper is still at an institution selector, CARSI/Shibboleth/OpenAthens handoff, or equivalent SSO step before CAS. Both are non-final states; keep cas_waiting_user for backward-compatible manifests.

Use si_only_downloaded when one or more official supporting-information files were verified but the main article PDF remains unavailable through the user's authorized access. Do not call this downloaded.

pdf_loading, pdf_visible_unsaved, and saved_pending_verification are progress states, not completed downloads. Use identity_mismatch for a saved file belonging to another article/asset. Keep browser_control_unavailable and host_execution_denied separate from login/publisher challenges: record the observed failing operation and leave its unknown cause unknown. Maintain SI inventory/completeness separately from the main status.

Use summon_unreachable when the Summon SPA repeatedly returns ERR_EMPTY_RESPONSE or cannot load after a single fresh retry. Use browser_pdf_viewer_fallback_needed when Chrome visibly displays the PDF but browser-context fetch() cannot retrieve its bytes. Neither status means the paper is unavailable; both specify the next legitimate fallback.

Use publisher_verification_waiting_user or sciencedirect_robot_check when a publisher page shows "Are you a robot?", CAPTCHA, Cloudflare, bot verification, or another anti-automation challenge. Do not treat this as a final failure, but do not try to solve it automatically.

Start Chrome Control

Use the web-access CDP proxy when available.

On Windows PowerShell:

powershell
$node = "node"
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
  $node = "$env:LOCALAPPDATA\OpenAI\Codex\bin\node.exe"
}
$checkDepsCandidates = @(
  "$env:USERPROFILE\.claude\skills\web-access-main\scripts\check-deps.mjs",
  "$env:USERPROFILE\.agents\skills\web-access-main\scripts\check-deps.mjs",
  "$env:USERPROFILE\.codex\skills\web-access-main\scripts\check-deps.mjs"
)
$checkDeps = $checkDepsCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $checkDeps) { throw "web-access-main/scripts/check-deps.mjs not found" }
& $node $checkDeps

Then test:

powershell
Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3456/targets" -TimeoutSec 10

If this hangs or fails:

  • Inspect the current tool error and existing proxy health/log evidence first. A connection failure does not establish that the remote-debugging checkbox is off or the library session expired.
  • Ask the user to check a specific setting only when current evidence points to it; reuse prior confirmation within its scope.
  • Read an existing proxy log if relevant, but put new logs and temporary output in the user's approved destination, not an unapproved default temporary directory.
  • Do not attempt to read Chrome session files or retry a host-denied operation through another interface.

Core CDP Proxy API

The usual web-access proxy is http://127.0.0.1:3456.

EndpointMethodPurpose
/healthGETProxy health and Chrome connection status
/targetsGETList open Chrome tabs
/new?url=...GETCreate a new background tab
/navigate?target=...&url=...GETNavigate an existing tab
/close?target=...GETClose a tab
/info?target=...GETGet page title, URL, and readyState
/eval?target=...POST body=JSExecute JavaScript in a tab and return { value: ... }
/clickAt?target=...POST body=CSS selectorClick the center of a visible element

Use /navigate rather than /new for Summon URLs containing #! fragments. If a #! fragment is stripped, Chrome may open about:blank or a wrong page. If curl is unavailable, use PowerShell Invoke-WebRequest for simple checks or Node.js fetch() for proxy calls.

Recommended Search Workflow

Prefer the library discovery route before direct publisher pages. It is more stable and less likely to trigger bot protection.

  1. Search by DOI or exact title in ZJU Summon:
    • https://zju.summon.serialssolutions.com/search?#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=<URL-encoded DOI or title>
  2. Open Summon URLs through scripts/cdp_open_url.mjs or otherwise fully URL-encode the nested URL when calling the CDP proxy. Summon uses #!; if the # fragment is stripped, Chrome may open about:blank or the wrong page.
  3. Read the result page with /eval.
  4. Extract links whose visible text or aria-label is:
    • PDF
    • 在线全文
    • Full Text
    • View PDF
    • publisher-specific full-text entries.
  5. Prefer the result's PDF link when present.
  6. Open the PDF link in a new background tab through the CDP proxy.
  7. If the publisher shows a security challenge, ask the user to complete it manually.
  8. Once the PDF is visible in Chrome, use scripts/browser_pdf_downloader.mjs to save it from the authenticated browser context.

Summon Field Notes

When extracting PDF, online full text, or publisher links from Summon:

  1. Skip empty href values. The first online-full-text match can be a facet toggle rather than a real link.
  2. Treat Summon as a slow SPA: wait about 6 seconds after navigation, then retry link extraction up to 3 times with short pauses.
  3. If Summon redirects to login.serialssolutions.com/sso/login and says the IP is outside the authorized range, record ip_not_authorized. In that case the user may need the ZJU RVPN/SSLVPN client, not only WebVPN in a browser page, because CDP-controlled Chrome tabs may still use the local network IP.
  4. If Summon has no PDF but has an online-full-text link, follow that route before constructing a publisher URL manually.
  5. If the page consistently shows ERR_EMPTY_RESPONSE or fails to render after one fresh navigation and the normal SPA waits, record summon_unreachable. Do not loop on Summon: try the DOI's publisher landing page or a confirmed OA route once, still using the user's authorized browser session where required.

Publisher-Specific Patterns

Use these as DOI-based repair hints only after confirming the paper identity. Do not claim access if the page or PDF is not actually verified.

ACS Publications

For DOI prefix 10.1021/...:

text
https://pubs.acs.org/doi/pdf/<doi>

ACS supporting information often follows:

text
https://pubs.acs.org/doi/suppl/<doi>/suppl_file/<journal-code>_si_001.pdf

The verified example 10.1021/acs.biomac.4c00102 used bm4c00102_si_001.pdf.

Start from the ACS article landing page whenever possible. A short Chinese 请稍候... interstitial can clear by itself; wait about 5-10 seconds and inspect the page once before classifying it as a publisher challenge. A readable abstract page does not prove that the main PDF is authorized: if it still shows Available to Purchase or Access through Institution, record the appropriate institutional-login or purchase status and leave any sign-in selection for the user.

ACS supporting-information links shown on the article page may legitimately lead to ACS Figshare / ndownloader.figstatic.com downloads even when the main PDF is not authorized. Follow visible official links, verify the resulting SI PDF, and record si_only_downloaded until the main article is also verified. Do not guess a supplement filename beyond an article-page link, and do not treat accessible SI as permission to retrieve the paywalled main paper.

Wiley

For DOI prefixes such as 10.1002/... or 10.1111/..., first navigate to the authenticated Wiley article page, then fetch from that page's own origin:

text
<location.origin>/doi/pdfdirect/<doi>?download=true

Do not hardcode onlinelibrary.wiley.com: Summon may authenticate through a subdomain such as advanced.onlinelibrary.wiley.com, and cross-origin fetches can fail. Also avoid navigating the tab directly to pdfdirect, because the browser may start a download and leave the page context unusable. Prefer page-context fetch().

Springer Nature

For DOI prefixes such as 10.1007/... and 10.1186/...:

text
https://link.springer.com/content/pdf/<doi>.pdf

This usually works after the institutional login is resolved. Use browser-context fetch if direct shell download returns 401, 403, or an HTML login page.

Nature Communications

For OA DOI patterns such as 10.1038/s41467-..., try:

text
https://www.nature.com/articles/<article-id>.pdf

Extract <article-id> from the DOI suffix and still verify the PDF header and text.

bioRxiv

For DOI prefix 10.1101/..., try:

text
https://www.biorxiv.org/content/<doi>v1.full.pdf

If version 1 returns 404, try the article page or a later version. Verify that the title matches.

Frontiers

For DOI prefix 10.3389/..., try:

text
https://www.frontiersin.org/articles/<doi>/pdf

If it fails, open the article page first and use its visible PDF link.

RSC Publishing

For DOI prefix 10.1039/..., do not assume ZJU has authorized full-text access. If PDF links return 404 or purchase pages, inspect the article page and record no_authorized_pdf_found or purchase_required rather than retrying aggressively.

Publisher Verification and ScienceDirect

ScienceDirect and some publisher platforms may show "Are you a robot?", CAPTCHA, Cloudflare, bot verification, or similar checks after repeated direct DOI navigation or automated tab opening. These pages are security and anti-automation challenges, not ordinary login confirmations.

Reduce the chance of triggering them by using a conservative access pattern:

  1. Prefer ZJU Summon / WebVPN / library 在线全文 links before direct doi.org -> publisher navigation.
  2. Process automatic downloads conservatively and respect publisher terms; use approved APIs where automation is not permitted.
  3. Keep a visible audit trail. For a user-requested modest human-attention batch, a few remaining article pages may be opened sequentially; avoid request bursts, duplicate tabs, and multiple concurrent SSO flows. A challenge stops automated activity on that page, not unrelated permitted work.
  4. Wait for each page to settle before looking for Download PDF, View PDF, or PDF.
  5. Reuse the same tab after the user completes a verification step instead of opening repeated new tabs.
  6. Avoid retry loops. One failed automatic attempt is enough before handing the page to the user.

When a publisher verification page appears:

  1. Stop automated actions on that tab.
  2. Record the paper in publisher_verification.tsv or the main manifest with status publisher_verification_waiting_user; use sciencedirect_robot_check for ScienceDirect's "Are you a robot?" page.
  3. Tell the user which paper and tab need manual attention.
  4. Do not click CAPTCHA, Cloudflare, "Are you a robot?", bot-check, or similar challenge controls automatically.
  5. After the user says the verification is complete, continue from the same tab and try the visible article/PDF route once.
  6. If verification immediately reappears, mark do_not_auto_retry and move on.

ScienceDirect / Elsevier Field-Tested Workflow

ScienceDirect can show a "please wait" interstitial after CDP navigation. That page is not always a CAPTCHA. First wait briefly and inspect visible text: only treat it as sciencedirect_robot_check when it actually shows "Are you a robot?", CAPTCHA, Cloudflare, or another verification challenge.

For Elsevier papers, a practical workflow is:

  1. Resolve institutional access once per browser session. From an article page, use "Access through Zhejiang University" or the Shibboleth handoff to ZJU CAS if needed.
  2. After successful access, authenticated article pages often show Brought to you by: Zhejiang University Library.
  3. For a modest manual-attention batch, open the remaining Elsevier DOI/article tabs, then notify the user that those tabs need manual clicks. The user handles interstitials, CAPTCHA, CAS, or "Access through Zhejiang University" buttons.
  4. After the user confirms, scan tabs for article pages containing both Brought to you by and Zhejiang.
  5. Find the main article View PDF link carefully. ScienceDirect pages may contain reference-section View PDF links far down the page. Normalize whitespace with a.textContent.replace(/\s/g, " ").trim() === "View PDF", then prefer the link nearest the top toolbar or matching the article PII.
  6. When the user clicks View PDF, Chrome may open a new pdf.sciencedirectassets.com tab with a time-limited signed PDF URL. Where permitted, use the supported authenticated save/download route; page-context fetch is only one option and can fail in the native viewer. Verify the saved file before closing a task-owned tab no longer needed for SI.
  7. Failed to fetch alone does not identify an expired URL: viewer restrictions, loading, network routing, and access checks are also possible. Inspect the observed page/error once and use the recovery reference; do not automatically ask the user to re-click or log in again.

This is still a human-in-the-loop workflow. Do not automate CAPTCHA, bot checks, or security prompts, and do not open very large ScienceDirect batches.

Create or update publisher_verification.tsv when publisher checks interrupt a batch. Use this header:

text
id	project	title	doi	year	venue	publisher	status	source_url	current_url	next_action	notes

Suggested next_action values:

text
user_complete_publisher_verification
retry_same_tab_after_user_confirms
try_summon_route
try_authorized_oa_route
mark_do_not_auto_retry

PowerShell example for opening a Summon URL safely:

powershell
$node = "$env:LOCALAPPDATA\OpenAI\Codex\bin\node.exe"
& $node "$env:USERPROFILE\.claude\skills\zju-literature-downloader\scripts\cdp_open_url.mjs" `
  --url "https://zju.summon.serialssolutions.com/search?#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=10.1021%2Facs.biomac.4c00102" `
  --wait

CAS SSO Handoff and Retry

Some publishers, especially Elsevier/ScienceDirect, Springer Nature, Nature Portfolio, Wiley, Taylor & Francis, Cell Press, and society platforms routed through Shibboleth/OpenAthens, may redirect to Zhejiang University CAS even when WebVPN is open. This is not a reason to ask for the user's password.

When a paper reaches a CAS or institutional SSO page:

  1. Stop automated actions on that tab.
  2. Record the paper in cas_retry.tsv with status cas_waiting_user.
  3. Tell the user exactly which tab/page needs attention, for example: "This paper is at ZJU CAS. If Chrome has already filled the account and password, I can click the login/confirm button once with your authorization; otherwise please complete it in Chrome."
  4. Do not read, store, or request the password, QR result, OTP, SMS code, CAPTCHA, cookie, or local/session storage.
  5. If the user explicitly authorizes clicking because the CAS credentials are already filled in Chrome, click only the visible ZJU CAS/WebVPN/institutional SSO login/confirm button once. Do not type into fields or inspect hidden credential values.
  6. If QR login, SMS/OTP, CAPTCHA, Cloudflare, or publisher bot verification appears, stop and let the user complete it manually.
  7. After the login/confirm step completes, refresh or continue from the same tab.
  8. Re-detect whether the page is now a publisher article page, a PDF viewer, or another institutional handoff.
  9. If resolved, download and verify the PDF/SI, then update the manifest status to downloaded or downloaded_with_si.
  10. If it loops back to CAS after a completed user login, record failed_after_retry with the observed reason and move on.

Known ZJU CAS details observed during use:

  • The CAS page may be on zjuam.zju.edu.cn.
  • Common fields include id="username", id="password", and sometimes id="authcode".
  • The authcode field is a manual verification step; do not attempt to solve or fill it.
  • Chrome does not reliably expose or autofill ZJU CAS credentials in a way the agent can depend on. If the login button click does not advance within about 15 seconds, stop and let the user finish the login manually.

Safe CAS Auto-Confirm

The agent may click a ZJU CAS saved-login confirmation button only when all conditions are true:

text
1. The page is on an expected institutional domain such as zjuam.zju.edu.cn, webvpn.zju.edu.cn, libweb.zju.edu.cn, or an institution-redirect page reached from Summon/publisher access.
2. The user has explicitly authorized this action in the current conversation, for example: "可以点浙大 CAS 登录按钮".
3. The visible action is clearly a login/confirm/continue button, such as 登录, 登 录, 确认登录, 继续登录, Continue, Proceed, or Sign in.
4. There is no visible CAPTCHA, Cloudflare challenge, QR-only login, SMS/OTP field, push-approval prompt, password reset prompt, consent-to-share-new-data prompt, or account/security warning.
5. The agent does not read, reveal, copy, store, type, or modify credentials.

If any condition is unclear, pause and ask the user to handle that tab. Do not repeatedly click login; one click is enough to test whether the saved-login state works.

Create or update cas_retry.tsv whenever CAS blocks a batch. Use this header:

text
id	project	title	doi	year	venue	publisher	failure_stage	status	source_url	current_url	next_action	notes

Suggested next_action values:

text
user_complete_cas_in_chrome
retry_same_tab_after_user_confirms
repair_url_by_doi
inspect_summon_alternative_links
mark_no_authorized_pdf

For a CAS retry batch, process one or a few tabs at a time. Do not open many CAS/login tabs in parallel; it can confuse the user's session and increase publisher or SSO risk.

User Notification

When intervention is actually needed, identify the paper, current visible page title, browser/window, and exact human action. Use a supported local notification helper only if available and authorized; ordinary chat is sufficient. Do not claim the user can see a page merely because an open-URL command returned success. Do not make a machine-specific helper a dependency.

Download PDF From Browser Context

Use the bundled script when a PDF URL opens in Chrome but direct shell download returns 403, 401, Cloudflare HTML, or a login page.

powershell
$node = "$env:LOCALAPPDATA\OpenAI\Codex\bin\node.exe"
& $node "$env:USERPROFILE\.agents\skills\zju-literature-downloader\scripts\browser_pdf_downloader.mjs" `
  --url "https://pubs.acs.org/doi/pdf/10.1021/acs.biomac.4c00102" `
  --out "D:\path\paper.pdf"

The script:

  • Opens the URL in the user's controlled Chrome session unless --target is provided.
  • Runs fetch(location.href, { credentials: "include" }) inside the page.
  • Transfers bytes in chunks through the local CDP proxy.
  • Writes the binary file to disk.
  • Verifies the %PDF signature by default.

Useful options:

text
--url <url>          PDF URL to open and save
--target <targetId>  Existing Chrome target/tab id to use
--out <path>         Output PDF path
--proxy <url>        CDP proxy URL, default http://127.0.0.1:3456
--close              Close the tab after download if the script opened it
--allow-non-pdf      Save even when content does not start with %PDF

Chrome Download Fallback

The helper is for an authenticated HTML/PDF page that exposes bytes to page-context fetch(). It can fail with an empty result or a browser fetch error when Chrome has opened its native PDF viewer, even though the user can read the PDF in that tab. This is a browser-viewer limitation, not an access verdict.

When that happens:

  1. Mark browser_pdf_viewer_fallback_needed; do not retry the same viewer URL in a loop.
  2. Return to the article landing page and use the visible official Download PDF / View PDF action once.
  3. Wait for the normal Chrome download to finish in the approved destination. Configure that location before the download; do not silently fall back to the system Downloads folder. Ignore .crdownload and other incomplete files.
  4. Identify the new file by its modification time, plausible size, %PDF signature, and extracted title/DOI; never copy the first matching PDF merely because filenames can acquire (1) suffixes.
  5. Copy the verified file to the requested final folder by default, preserving originals. Move only if authorized. Update the manifest; if the landing page requests institutional login or a security challenge, leave that page for the user instead.

If a direct curl/Invoke-WebRequest attempt fails with 403, HTML content, or Windows CRYPT_E_REVOCATION_OFFLINE, do not weaken TLS revocation checks to force a download. Use the normal browser landing-page route above.

Page-Context Fetch Pattern

For cases where the bundled script is not flexible enough, use the same idea directly in the authenticated tab:

javascript
const init = await proxyEval(targetId, `(async()=>{
  const r = await fetch("${pdfUrl}", { credentials: "include" });
  const ab = await r.arrayBuffer();
  window.__zjuPdfBytes = new Uint8Array(ab);
  return {
    ok: r.ok,
    ct: r.headers.get("content-type"),
    n: window.__zjuPdfBytes.length,
    head: Array.from(window.__zjuPdfBytes.slice(0, 8))
  };
})()`);

const head = Buffer.from(init.value.head).toString("ascii");
if (!head.startsWith("%PDF")) throw new Error("Not a PDF response");

Then transfer window.__zjuPdfBytes in chunks through /eval. This pattern is useful for Wiley same-origin pdfdirect links and ScienceDirect signed PDF tabs.

Supporting Information

Always try to download supporting information when the user wants complete reading.

Preferred method:

  1. Open the article landing page, not only the PDF page.
  2. Extract all links with text or href matching:
    • Supporting Information
    • Supplementary
    • Supplemental
    • /doi/suppl/
    • /suppl_file/
    • _si_
    • _mmc
    • appendix
  3. Download every PDF/DOCX/XLSX/video/data file that is clearly a legitimate supplement, using the browser context if needed.

ACS fallback pattern, only after verifying the DOI and article page:

text
https://pubs.acs.org/doi/suppl/<DOI>/suppl_file/<journal-code>_si_001.pdf

For example, the verified test case used:

text
https://pubs.acs.org/doi/suppl/10.1021/acs.biomac.4c00102/suppl_file/bm4c00102_si_001.pdf

Do not invent supplement URLs as facts. If a guessed URL returns 404, record "not found" and inspect the article page.

For Elsevier/ScienceDirect, supporting files may use _mmc naming or appear as multimedia components on the article page. For RSC, supporting links often contain suppdata, but the main PDF may still be unavailable through institutional access.

Inventory SI by asset, not just paper. Retain the publisher label and original filename, distinguish experimental SI/source data from data-availability metadata, and validate the actual format. Keep documents/tables/images, large video/media, and archives separate when requested, retaining each paper identifier. Small files are not automatically invalid. Missing links in one extraction mean SI completeness is unknown, not that no SI exists.

Verification and Reading

After downloading, verify every file.

For PDFs:

powershell
$env:PYTHONUTF8='1'
python -X utf8 "$env:USERPROFILE\.claude\skills\zju-literature-downloader\scripts\extract_pdf_text.py" `
  --pdf "D:\path\paper.pdf" `
  --pages 3

This should report page count and extracted text. The script also reconfigures stdout/stderr to UTF-8 internally to reduce Windows GBK failures. If extraction fails but the PDF is valid, try PyMuPDF, OCR, or the local pdf skill.

On Windows, always set PYTHONUTF8=1 and use python -X utf8 when extracting text. If console text still displays poorly, check the JSON or metadata output first; the PDF may be valid even when terminal rendering is not.

Minimum verification checklist:

  • File exists and size is plausible.
  • First bytes are %PDF for PDF files.
  • Page count is nonzero.
  • Identity matches the intended main article or supplement. A matching DOI in a bibliography alone is insufficient; inspect title-area text or verify visually/OCR when needed.
  • Save a small manifest with DOI, title, canonical source URL, local path, verification result/date, and separate main/SI states when doing more than one paper. Do not log signed PDF query strings.
  • downloaded requires a saved verified main PDF; downloaded_with_si additionally requires all known requested SI. Preserve unknown SI completeness and keep SI-only progress separate.

Zotero

Zotero import is useful for metadata, DOI, citation keys, and library organization, but it does not replace local PDF verification. If Zotero imports a paper, still check whether the PDF attachment is present and readable. If the user wants a project folder with full text, save PDFs explicitly to that folder.

Naming Convention

Use readable filenames:

text
FirstAuthor_Year_Journal_short-title.pdf
FirstAuthor_Year_Journal_short-title_SI.pdf

If filenames are Chinese-friendly, prefix supplements with 补充_ or otherwise make SI files visually distinct from main papers.

For project work, keep a folder like:

text
文献自动下载/
  manifest.tsv
  PDFs/
  SupportingInformation/
  extracted_text/

Failure Handling

If direct publisher navigation triggers ScienceDirect "Are you a robot?", Cloudflare, CAPTCHA, or another bot challenge:

  • Do not bypass it.
  • Do not auto-click the challenge.
  • Record publisher_verification_waiting_user or sciencedirect_robot_check.
  • Ask the user to solve it in Chrome.
  • Then continue once from the same now-open page.
  • If the same challenge immediately reappears, mark do_not_auto_retry and move on.

If shell Invoke-WebRequest or curl returns 403 but the PDF opens in Chrome:

  • First use browser_pdf_downloader.mjs from an authenticated HTML/PDF page.
  • If the script reports a Chrome PDF-viewer fetch limitation, use the article page's visible Download PDF control and verify the browser download. Do not conclude that access failed from the helper error alone.

If a page shows publisher bot verification, CAPTCHA, Cloudflare, QR login, SMS/OTP, or another security challenge:

  • Do not ask for or accept credentials in chat.
  • Pause and ask the user to complete the verification in Chrome.
  • Record publisher_verification_waiting_user in publisher_verification.tsv, or sciencedirect_robot_check for ScienceDirect.
  • Continue only after the user says the browser step is complete.

If a page shows Zhejiang University CAS, unified identity authentication, Shibboleth, OpenAthens, SAML, or institutional sign-in:

  • Do not ask for or accept credentials in chat.
  • If the user has explicitly authorized it and Chrome has already filled the ZJU CAS fields, click the visible login/confirm button once.
  • Otherwise pause and ask the user to complete the login in Chrome.
  • Record cas_waiting_user or cas_resolved_retry_needed in cas_retry.tsv as appropriate.

If Summon shows no PDF:

  • Try 在线全文.
  • Try DOI on the publisher page.
  • Check open-access copies only from legitimate sources.
  • Record "no authorized PDF found" rather than seeking unauthorized mirrors.

If Summon or another site opens as about:blank:

  • Treat it as a URL-fragment/encoding problem first, especially when the original URL contains #!.
  • Reopen through scripts/cdp_open_url.mjs --url "<full URL>" --wait.
  • Do not paste fragment-heavy URLs unquoted into shell commands or manually concatenate them into /new?url=... without URL encoding.

If curl is unavailable:

  • Use PowerShell Invoke-WebRequest for simple proxy checks.
  • Prefer the bundled Node.js helper scripts for CDP proxy actions because Node's URLSearchParams preserves nested URL fragments correctly.

If the session expires:

  • Ask the user to log in again through WebVPN.

Common pitfalls:

ProblemLikely causePractical fix
Summon opens about:blank#! fragment strippedUse scripts/cdp_open_url.mjs or /navigate with a fully encoded URL
First Summon online-full-text link does nothingEmpty href facet toggleSkip empty links and retry after SPA rendering
Serials Solutions says IP is outside authorized rangeCDP Chrome traffic is off-campusAsk user to use RVPN/SSLVPN or another authorized network route
CAS auto-click does not workCredentials not filled, authcode present, or login loopStop after one authorized click and ask the user to finish manually
Wiley fetch returns an empty object or CORS errorWrong Wiley originFetch location.origin + "/doi/pdfdirect/<doi>?download=true" from the authenticated article page
ScienceDirect View PDF opens the wrong articleReference-section PDF link selectedNormalize whitespace and choose the top toolbar/main-article link
pdf.sciencedirectassets.com fetch failsCause not established by the fetch error aloneInspect loading/viewer/access/network evidence; use the supported normal save route, not a repeated login/re-click loop
Summon shows ERR_EMPTY_RESPONSESummon SPA/network route is unavailable to the controlled tabRecord summon_unreachable; fall back once to the DOI landing page or confirmed OA route
browser_pdf_downloader.mjs reports an empty browser fetchChrome native PDF viewer does not expose bytes to page-context fetchUse the article page's visible download action, then verify the completed Chrome download
curl reports CRYPT_E_REVOCATION_OFFLINEWindows cannot check certificate revocation from that shell routeDo not disable revocation checking; use Chrome's official download action
ACS main PDF is purchase-only but SI downloadsSI is publicly served; main article remains paywalledSave and verify SI, record si_only_downloaded, and keep main-PDF status separate
RSC PDF URL returns 404 or purchase pageNo authorized accessRecord no_authorized_pdf_found or purchase_required
Node require() fails inside .mjsES module contextUse import syntax
Python text extraction prints garbled ChineseWindows console encodingUse PYTHONUTF8=1 and python -X utf8

Verified Test Case

This workflow was verified with:

  • Title: Innovative Use of an Injectable, Self-Healing Drug-Loaded Pectin-Based Hydrogel for Micro- and Supermicro-Vascular Anastomoses
  • DOI: 10.1021/acs.biomac.4c00102
  • Source route: ZJU Summon PDF link -> ACS PDF page
  • Output: main PDF and ACS supporting information PDF
  • Verification: main PDF 17 pages, SI PDF 31 pages, both text-readable.

Additional field-tested cases recorded from later use:

  • Wiley same-origin PDF fetch: DOI 10.1002/adhm.202405260.
  • Nature Communications OA direct PDF: DOI pattern 10.1038/s41467-....
  • Springer direct PDF after CAS/institutional access: DOI pattern 10.1007/....
  • ScienceDirect / Elsevier: Shibboleth plus user-handled verification, then download from pdf.sciencedirectassets.com tabs.

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Zju Literature Downloader faz?

Use esta habilidade sempre que o usuário quiser usar a própria sessão autenticada da Zhejiang University Library, WebVPN, CAS SSO, 求是学术搜索, Summon, ScienceDirect, de uma editora ou do Chrome para pesquisar, baixar, organizar, tentar novamente e ler PDFs acadêmicos e materiais complementares legalmente. Acione esta habilidade em pedidos como “baixar artigos pela biblioteca da Zhejiang University”, “baixar PDF pelo WebVPN”, “tentar baixar novamente após falha na autenticação CAS”, “continuar após a verificação humana do ScienceDirect”, “baixar materiais complementares automaticamente”, “ler o...

Por que usar Zju Literature Downloader no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Zju Literature Downloader é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Zju Literature Downloader no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/baihe26/zju-literature-downloader/tree/main. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Zju Literature Downloader?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Zju Literature Downloader?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Zju Literature Downloader com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Zju Literature Downloader é gratuita?

Sim. A habilidade é publicada no GitHub por baihe26 sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇