Skip to main content

CLI for saving and running Goodinfo stock screener presets with Playwright browser automation.

Project description

goodinfo-screener-cli

CI Publish to PyPI PyPI PyPI downloads Release License: MIT GitHub issues

goodinfo-screener-cli is a Python CLI for turning a Goodinfo stock screener URL that you already use manually into a repeatable local workflow.

It saves named screener presets, opens them with a local Playwright browser, waits for the Goodinfo result table, parses the visible rows, prints a terminal preview, and can export the same data to CSV or JSON.

This project is intended for low-frequency personal research automation. It does not provide investment advice, trading recommendations, bulk crawling, login-only automation, or CAPTCHA bypassing.

What It Does

  • Saves Goodinfo StockList.asp screener URLs as named local presets
  • Stores presets in ~/.config/goodinfo-screener-cli/presets.yml
  • Runs a saved preset through Chromium with Playwright
  • Waits for the stock result table to become available
  • Parses rendered table headers and stock rows
  • Prints a compact Rich terminal table
  • Exports parsed rows to UTF-8 BOM CSV or pretty JSON
  • Supports visible browser debugging with --headful
  • Supports rendered HTML capture with --html for parser troubleshooting

Status

v0.1.x is the first MVP release line. The current scope is intentionally narrow:

Save one Goodinfo screener URL, run it locally, parse the rendered table,
preview the result, and export it.

See CHANGELOG.md for the release notes and verification summary. See docs/project-health.md for public project metrics, maintenance activity, roadmap evidence, and the AI-assisted maintenance plan.

Installation

This project targets Python 3.11 or newer.

Install from PyPI:

python -m pip install goodinfo-screener-cli

Install from a local checkout:

git clone https://github.com/pm7913/goodinfo-screener-cli.git
cd goodinfo-screener-cli
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"

Install Playwright's Chromium browser:

playwright install chromium

Verify the CLI:

goodinfo --help
goodinfo --version

Quick Start

Create the local preset store:

goodinfo init

Save a Goodinfo stock screener URL as a preset:

goodinfo import high-margin "https://goodinfo.tw/tw/StockList.asp?..."

Run the preset and print a readable preview:

goodinfo run high-margin --limit 10 --column-limit 8

Export the parsed rows:

goodinfo run high-margin \
  --csv results/high-margin.csv \
  --json results/high-margin.json

Debug page or parser changes with a visible browser and rendered HTML output:

goodinfo run high-margin --headful --html fixtures/high-margin.html

See examples/high-margin.yml for a sample preset based on a cumulative net profit margin screener.

Demo

Terminal demo of goodinfo-screener-cli running a saved screener preset

The CLI keeps the workflow local and inspectable: save one screener URL, run it through a browser session you control, review a compact terminal table, and write CSV or JSON when you need to continue the analysis elsewhere.

Commands

goodinfo init

Creates the local preset directory and an empty preset file if needed.

Default location:

~/.config/goodinfo-screener-cli/
  presets.yml

goodinfo import <name> <url>

Validates and saves a Goodinfo screener URL.

Rules:

  • <name> must be unique unless --force is used
  • URL must use https://goodinfo.tw/
  • URL path must target /tw/StockList.asp

Examples:

goodinfo import high-margin "https://goodinfo.tw/tw/StockList.asp?..."
goodinfo import high-margin "https://goodinfo.tw/tw/StockList.asp?..." --force

goodinfo list

Prints saved presets with their name, source, creation time, and URL.

goodinfo list

goodinfo run <name>

Loads a saved preset, opens it in Playwright, parses the rendered Goodinfo table, prints a terminal preview, and optionally writes export files.

Useful options:

goodinfo run high-margin
goodinfo run high-margin --headful
goodinfo run high-margin --timeout 45000
goodinfo run high-margin --limit 25 --column-limit 8
goodinfo run high-margin --csv results/high-margin.csv
goodinfo run high-margin --json results/high-margin.json
goodinfo run high-margin --html fixtures/high-margin.html

goodinfo remove <name>

Deletes a saved preset from the local preset file.

goodinfo remove high-margin

Preset Format

Presets are stored locally as YAML:

presets:
  high-margin:
    source: goodinfo
    url: "https://goodinfo.tw/tw/StockList.asp?..."
    created_at: "2026-06-01T00:00:00Z"
    browser:
      headless: true
      timeout_ms: 30000
    output:
      format: table

The CLI currently creates and reads the preset metadata needed for the MVP workflow. Extra fields are reserved for future configuration.

Output

Terminal output uses Rich tables and is designed for quick inspection:

  • --limit <n> controls how many rows are printed
  • --limit 0 prints all rows
  • --column-limit <n> controls how many columns are printed
  • --column-limit 0 prints all columns

Exports preserve the first-seen column order from parsed rows:

  • --csv <path> writes UTF-8 BOM CSV for spreadsheet compatibility
  • --json <path> writes pretty UTF-8 JSON

Responsible Use

This tool is designed for transparent, user-controlled, low-frequency personal research automation.

Expected safeguards:

  • Use a real local browser session
  • Run one saved screener preset at a time
  • Avoid high-frequency requests and bulk crawling
  • Do not bypass CAPTCHAs, paywalls, account restrictions, or access controls
  • Do not automate login-only workflows
  • Do not redistribute proprietary datasets
  • Verify market data before relying on it
  • Respect Goodinfo's terms, privacy policy, and website availability

This project does not provide investment advice or trading recommendations. Users are responsible for ensuring their use complies with Goodinfo's terms and applicable laws.

Troubleshooting

Playwright Browser Is Not Installed

If goodinfo run fails because Chromium is missing, install it:

playwright install chromium

Goodinfo Page Loads But Parsing Fails

Goodinfo may change table markup over time. Re-run with rendered HTML output:

goodinfo run high-margin --html fixtures/high-margin.html

Then inspect whether the stock result table still uses #tblStockList or a recognizable stock table structure.

Terminal Table Is Too Wide

Goodinfo tables can have many columns. Limit the preview:

goodinfo run high-margin --limit 10 --column-limit 8

Use --column-limit 0 only when your terminal is wide enough.

Browser Launch Fails On macOS

Headless browser launch can fail in restricted sandbox environments. Try running from a normal terminal session, or use:

goodinfo run high-margin --headful

Development

Install development dependencies with the editable install shown above, then run:

pytest
ruff check .
goodinfo --help

The implementation is split into small modules:

  • cli.py owns command parsing and user-facing errors
  • presets.py manages local YAML preset storage and validation
  • browser.py wraps Playwright page loading
  • parser.py extracts stock rows from rendered Goodinfo HTML
  • exporters.py renders terminal tables and writes CSV/JSON files

Tests avoid live Goodinfo requests by using synthetic fixtures and focused unit coverage. Browser smoke tests can be run manually when checking real site behavior.

See CONTRIBUTING.md for the pull request workflow and responsible-use contribution requirements.

Roadmap

Near-term follow-up work is tracked in GitHub issues:

Out of scope for the MVP:

  • Building every Goodinfo filter condition from CLI flags
  • Running many presets in parallel
  • Crawling individual stock detail pages
  • Scheduled jobs
  • Login-only workflows
  • CAPTCHA handling or bypassing
  • Hidden API reverse engineering as the default approach
  • Investment strategy recommendations

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goodinfo_screener_cli-0.1.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goodinfo_screener_cli-0.1.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file goodinfo_screener_cli-0.1.1.tar.gz.

File metadata

  • Download URL: goodinfo_screener_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for goodinfo_screener_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ca936bbca6a92d5a09a298f345fca9bc44ea15fbe22c8c8221925c47b9c33238
MD5 aadd66e99caf67f5c65ba60862fe5eae
BLAKE2b-256 12cdbfc1f9e4c79d59c3acbd6bf504182c1ae551721f503841fdc71801848412

See more details on using hashes here.

Provenance

The following attestation bundles were made for goodinfo_screener_cli-0.1.1.tar.gz:

Publisher: publish.yml on pm7913/goodinfo-screener-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file goodinfo_screener_cli-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for goodinfo_screener_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 361583eca16435e55e24b6f2a42e5b71de56c7bb296f5d825f5b773e7e623fd0
MD5 4bbd17947f5823e87a30eac3f8f665f9
BLAKE2b-256 1625b5ea86ea9e421f5025a2fccea0ad9fab84ce445bbff55f8b0048dd1d5de3

See more details on using hashes here.

Provenance

The following attestation bundles were made for goodinfo_screener_cli-0.1.1-py3-none-any.whl:

Publisher: publish.yml on pm7913/goodinfo-screener-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page