ph_ai_tracker
A small Python library that finds trending AI products on Product Hunt.
- Primary: Product Hunt GraphQL API v2
- Secondary: Web scraping fallback (BeautifulSoup) for when the API is unavailable / rate-limited
Install (dev)
poetry install
Install (PyPI)
pip install ph-ai-tracker
Optional (faster HTML parsing with lxml):
pip install "ph-ai-tracker[lxml]"
Quickstart
from ph_ai_tracker import AIProductTracker
tracker = AIProductTracker(
api_token="YOUR_PRODUCTHUNT_TOKEN", # optional
strategy="auto", # api | scraper | auto
)
result = tracker.get_products(search_term="AI", limit=20)
print(result.to_pretty_json())
Or from the terminal (prints pretty JSON):
poetry run python -m ph_ai_tracker --strategy scraper --search AI --limit 10
By default, each run is also persisted to SQLite at ./data/ph_ai_tracker.db.
poetry run python -m ph_ai_tracker --strategy scraper --db-path ./data/ph_ai_tracker.db
Use --no-persist to skip DB writes for one-off runs.
Scheduler (Sprint 2)
Run one scheduled cycle (scrape + persist) via the scheduler command:
poetry run ph-ai-tracker-runner --strategy scraper --search AI --limit 20 --db-path ./data/ph_ai_tracker.db
Environment variables supported by scheduler runtime:
CRON_SCHEDULE(default:0 */6 * * *)TZ(default:UTC)PH_AI_TRACKER_STRATEGY(default:scraper)PH_AI_TRACKER_SEARCH(default:AI)PH_AI_TRACKER_LIMIT(default:20)PH_AI_DB_PATH(default:./data/ph_ai_tracker.db)PRODUCTHUNT_TOKEN(required for API strategy)PH_AI_RETRY_ATTEMPTS(default:2)PH_AI_RETRY_BACKOFF_SECONDS(default:2)
Cron helper files are available in scripts/cron/.
Docker + Persistent Volume (Sprint 3)
Build and start the scheduler container:
docker compose up -d --build
Watch scheduler logs:
docker compose logs -f scheduler
The SQLite database is stored on the named Docker volume ph_ai_tracker_data
at /data/ph_ai_tracker.db in the container.
Stop without deleting data:
docker compose down
If you remove containers and start again, data persists because the named volume is reused.
After installing from PyPI, you can also run:
ph-ai-tracker --strategy scraper --search AI --limit 10
Trending behavior
--strategy apidefaults to Product Hunt'sRANKINGorder.- The API client first attempts the
artificial-intelligencetopic; if the schema/topic query fails, it falls back to global posts and applies a client-side filter.
Product Hunt API token
Do not hardcode tokens in code or commit them to git.
Set your token as an environment variable:
export PRODUCTHUNT_TOKEN="<your_token>"
poetry run python -m ph_ai_tracker --strategy api --search AI --limit 10
Notes
- This project is intended to run well on PyPy 3.
- All tests are offline and use mocks/fixtures (no real network).
- Supported Python versions: 3.10–3.14
- Operational guide: see
RUNBOOK.md - Convenience commands:
make test,make runner,make docker-up,make docker-logs - Demo script:
scripts/demo_pipeline.sh - Requirements mapping:
REQUIREMENTS_TRACEABILITY.md - Final handoff checklist:
SUBMISSION_CHECKLIST.md
Metadata
Release files for ph-ai-tracker 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ph_ai_tracker-0.1.3.tar.gz | 14.1 kB | Without provenance | Details for ph_ai_tracker-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ph_ai_tracker-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for ph_ai_tracker-0.1.3-py3-none-any.whl |
Total release size: 31.3 kB
Release files / ph_ai_tracker-0.1.3.tar.gz
| Download URL | ph_ai_tracker-0.1.3.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29ca8208846e2f7113b5d8126296770511590f272df6e03b17fb73c34771e460
|
|
BLAKE2b-256 checksum How to use checksums |
9c3d7c448ea41ab8964c4ba139133b9a61db4611d657be2a50abc4fe49ed1c25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / ph_ai_tracker-0.1.3-py3-none-any.whl
| Download URL | ph_ai_tracker-0.1.3-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a2cb67ed8bb0c5494f8f643bea3ce3ce1b6ef6b6e1b6bc1e127f8f277c0824b
|
|
BLAKE2b-256 checksum How to use checksums |
1eacf9d224218523c4d048ce10568dd6395caae36abd11e305486f73a4314139
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for ph-ai-tracker 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.