A robust, asynchronous web scraper for the Laporan Harta Kekayaan Penyelenggara Negara (LHKPN) portal by the KPK (Komisi Pemberantasan Korupsi) Indonesia.
This tool allows you to search for public officials and extract their reported asset information, including detailed breakdowns of land, vehicles, assets, cash, and debts.
- Asynchronous: Built with
Playwrightandasynciofor efficiency. - Stealth: Uses
playwright-stealthto reduce detection. - Detailed Data: Extracts both summary information and detailed asset breakdowns from modals.
- Flexible CLI: Search by name, limit results, and export to JSON or CSV.
- Pagination Support: Automatically crawls through multiple pages of search results.
This project uses uv for dependency management.
-
Clone the repository:
git clone <repository-url> cd lhkpn
-
Install dependencies:
uv sync
-
Install Playwright browsers:
uv run playwright install chromium
The easiest way to use the scraper is via the main.py script.
# Basic search (saves to lhkpn_results.json by default)
uv run python main.py "Prabowo Subianto" --max-results inf
# Export to CSV with result limit
uv run python main.py "Prabowo Subianto" --max-results 5 --format csv --output prabowo_assets.csv
# Run in visible mode (not headless)
uv run python main.py "Prabowo Subianto" --no-headlessYou can also use the LHKPNScraper class in your own Python projects:
import asyncio
from lhkpn_scraper import LHKPNScraper
async def run():
scraper = LHKPNScraper(headless=True)
results = await scraper.run("Official Name", max_results=10)
for record in results:
print(f"{record['name']} - Total Assets: {record['total_harta']}")
if __name__ == "__main__":
asyncio.run(run())This tool is for educational and research purposes only. Please respect the KPK portal's terms of service and robots.txt. Ensure your usage complies with Indonesian law regarding public data access.
MIT License. See LICENSE for details.