SuperAPI AI Directory

patent-download

Office & productivity

View repository

Updated 10-16 08:34

About this skill

patent-download - Patent download tool

Download patent texts (PDF / abstract / full text) from multiple platforms based on patent numbers.

When to use / When not to use

Use: Download full-text patent PDFs, batch export patent documents, look up basic patent information. Do not use: Patent infringement comparison / claim analysis / validity verification, etc.; please use dedicated analysis tools.

Recommended channels

Google Patents (API, free and no login required) is the first choice, and Duyan Patents (browser) is the alternative. For the tested status, recommendation level, and access method of each platform, see references/platform-status.md。

Patent number format (key)

What users provide is often theapplication number(such as 202421964517.8), while Google Patents uses thepublication number(such as CN223081266U) for indexing. There is no mathematical correspondence between the two, andgoogle_patents.py will attempt automatic matching but success is not guaranteed.

For the complete application number/publication number structure, kind codes (A/B/U/S), the difference between invention A vs B, and default download rules, see references/patent-number-formats.md。

Usage

Unified entry point (recommended)

# 进入脚本目录(相对 skill 根)
cd scripts

# 查看支持的平台及状态
python cli.py --list

# Google Patents 下载(推荐,免费免登录)
python cli.py google CN223081266U
python cli.py google 202421964517.8      # 申请号自动匹配

# 仅查询专利信息,不下载
python cli.py google CN223081266U --info

# 度衍浏览器自动化(账号自动从环境变量读取)
python cli.py uyanip CN223081266U -m browser

# 批量下载
python cli.py google CN223081266U CN118198150A CN118198150B

Call platform scripts directly

python platforms/google_patents.py CN223081266U
python platforms/google_patents.py 202421964517.8 -o ~/Downloads
python platforms/uyanip.py 2024214535561

Credentials (environment variables, public release version)

Accounts for each platform are configured throughenvironment variables, the code is not hard-coded, and the repository does not store any account passwords.

Naming:PATENT_<平台>_USERNAME / PATENT_<平台>_PASSWORD(such as PATENT_UYANIP_USERNAME)。

Configuration process:

  1. cp config/.env.example config/.env
  2. Edit config/.env, fill in your registered account (already in .gitignore, not committed)
  3. Accounts are automatically loaded from environment variables / .env (scripts/platforms/_creds.py, no additional dependencies required)
  4. Security self-check:python scripts/platforms/_creds.py — Check whether .env has been mistakenly committed to git, and show whether each platform account is ready (without printing passwords)

For how to obtain accounts for each platform and ToS compliance notes, see references/accounts-setup.md. Google Patents and CNIPA epub are public and require no login, so no configuration is needed.

Parameter description

Parameter Description
-m, --method Download method: api or browser
-u, --username Username (read from environment variables by default)
-p, --password Password (read from environment variables by default)
-o, --output Output directory (defaults to the current directory)
--headless Headless mode (browser method)
--info Only query information, do not download (Google Patents only)

Dependencies

Ready to use out of the box (no installation required)

  • Google Patents information query:python cli.py google <号> --info uses only the standard library, zero dependencies
  • Credential self-check:python cli.py --list、python platforms/_creds.py zero dependencies
  • When the optional dependencies below are missing, the script will print a clear prompt and exit, and will not throw an obscure ImportError

Dependencies need to be installed

Install according to the channel used before the first download (unified command:pip install -r scripts/requirements.txt):

Channel Dependency Installation command
Google Patents download (recommended) patent-downloader pip install patent-downloader
Duyan/Greater Bay Area/PSS browser automation playwright + browser pip install playwright && playwright install chromium
PatentStar/epub API, etc. requests pip install requests

Install everything with one command:pip install -r scripts/requirements.txt。

Required permissions and security notes

This skill executes local scripts to complete patent downloads, involving the following capability boundaries, which you should be aware of before use:

Automatic dependency installation at runtime (please note)

  • scripts/patent-download.sh When dependencies are missing, the wrapper script willautomatically execute pip install and playwright install chromium:
    • When the first argument is google , if patent-downloader is not installed, it will automatically pip install patent-downloader;
    • When other arguments go through the old path, if playwright is not installed, it will automatically pip install -r requirements.txt and download the Chromium browser binary.
  • This automatic installationhas no fixed version (unpinned), and will pull the latest package from the network, posing a supply chain risk. Please be aware: before automatic installation, it is recommended to manually review scripts/requirements.txt, or switch to manual installation (pip install -r scripts/requirements.txt)。
  • Calling python cli.py <平台> <专利号> directly will not trigger automatic installation; when dependencies are missing, it will only print a clear prompt and exit.

Network access

  • Based on the patent numbers specified by the user, it initiates network requests to external platforms to download the full patent text/PDF: Google Patents (API), Duyan, Guangdong-Hong Kong-Macao, PSS, PatentStar, CNIPA epub, etc. The request target is determined by the patent number entered by the user, and local document contents are not uploaded.
  • Use requests / patent-downloader / playwright(browser automation) and other dependencies to complete the download.

Credential access

  • Accounts for each platform are read through environment variables (PATENT_<平台>_USERNAME / PATENT_<平台>_PASSWORD) or local config/.env (see the "Credentials" section). Credentials are used only for login and download, are not hardcoded, and passwords are not printed.
  • Credentials are equivalent to account passwords; do not screenshot, share, or submit them to any repository.

Browser automation

  • Some platforms (Duyan/Guangdong-Hong Kong-Macao/PSS) use Playwright to drive Chromium, supporting --headless headless mode. It will start a browser process on the local machine to perform login and download operations.

File access

  • Write the downloaded PDF/files to the user-specified output directory (-o, default current directory).

More

  • Usage examples and troubleshooting:references/examples.md
  • Change history:CHANGELOG.md