|
1 | 1 | # kdriver |
2 | 2 |
|
3 | | -TODO |
| 3 | +> This project is a Kotlin port of [@stephanlensky](https://github.com/stephanlensky)'s awesome Python |
| 4 | +> library [zendriver](https://github.com/stephanlensky/zendriver), built to bring the same simplicity and power of |
| 5 | +> CDP-based automation to the JVM world. |
| 6 | +
|
| 7 | +**Documentation:** *coming soon* |
| 8 | + |
| 9 | +kdriver is a blazing fast, coroutine-first, undetectable web scraping / browser automation library for Kotlin. It uses |
| 10 | +the Chrome DevTools Protocol (CDP) under the hood to interact with real Chrome instances, offering a sleek alternative |
| 11 | +to heavy tools like Selenium or Puppeteer — all without relying on WebDriver. |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +* **Undetectable** – Like its Python counterpart, kdriver speaks CDP directly, making it (almost) impossible for sites |
| 16 | + to detect. |
| 17 | +* **Blazing fast** – CDP is lightweight and extremely performant. Combined with Kotlin coroutines, you get low-latency |
| 18 | + scraping and automation. |
| 19 | +* **Simple and powerful API** – Designed to get you up and running with just a few lines of idiomatic Kotlin. |
| 20 | +* **No external dependencies** – kdriver interacts directly with the browser using WebSockets and JSON — no need for |
| 21 | + Chromium wrappers or native libraries. |
| 22 | +* **Session and cookie management** – Start with a clean profile every time or load/save cookies between runs. |
| 23 | +* **Element utilities** – Coming soon: intuitive APIs to query, interact with, and wait for DOM elements. |
| 24 | + |
| 25 | +## Motivation |
| 26 | + |
| 27 | +We chose Kotlin for this port because: |
| 28 | + |
| 29 | +* **First-class type safety and null safety** help catch bugs early and make the code more robust. |
| 30 | +* **It's the core language of our entire stack** (backends, Android apps, shared libraries). |
| 31 | +* **Multiplatform support** is on the roadmap, allowing future compatibility with native and JS targets. *(Currently |
| 32 | + JVM-only)* |
| 33 | + |
| 34 | +## Installation |
| 35 | + |
| 36 | +To use kdriver, add the following to your `build.gradle.kts`: |
| 37 | + |
| 38 | +```kotlin |
| 39 | +dependencies { |
| 40 | + implementation("dev.kdriver:core:0.1.5") |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +Make sure you have Maven Central configured: |
| 45 | + |
| 46 | +```kotlin |
| 47 | +repositories { |
| 48 | + mavenCentral() |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +## Usage |
| 53 | + |
| 54 | +Visit a website and do something on it: |
| 55 | + |
| 56 | +```kotlin |
| 57 | +fun main() = runBlocking { |
| 58 | + val browser = Browser.create(this) |
| 59 | + val tab = browser.get("https://www.browserscan.net/bot-detection") |
| 60 | + // Use tab to interact with the page |
| 61 | + browser.stop() |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +More examples coming soon! |
| 66 | + |
| 67 | +## Acknowledgments |
| 68 | + |
| 69 | +Huge thanks to [@stephanlensky](https://github.com/stephanlensky) for |
| 70 | +creating [zendriver](https://github.com/stephanlensky/zendriver), a brilliantly designed and maintained library that |
| 71 | +inspired this port. |
| 72 | +If you're using Python, we highly recommend checking out the original project! |
| 73 | + |
| 74 | +## Goals of the project |
| 75 | + |
| 76 | +The purpose of **kdriver** is to provide a clean, coroutine-native API for browser automation in Kotlin, while staying |
| 77 | +true to the goals of zendriver: |
| 78 | + |
| 79 | +1. Stay undetected in modern anti-bot environments |
| 80 | +2. Offer a developer-friendly experience with minimal setup |
| 81 | +3. Empower developers with a flexible, low-level browser interface |
| 82 | + |
| 83 | +This library is still in early development — feedback and contributions are very welcome! |
| 84 | + |
| 85 | +## Contributing |
| 86 | + |
| 87 | +We welcome contributions of all kinds — feel free to open issues, report bugs, or submit pull requests. |
0 commit comments