aaronlmathis / leetscraper

Command-line tool to query leetcode for the daily coding challenge (or any problem by slug) and outputs the problem description and codesnippet (languages of your choice) into a file for solving locally.

Repository from Github https://github.comaaronlmathis/leetscraperRepository from Github https://github.comaaronlmathis/leetscraper

🧠 LeetScraper

GitHub release

LeetScraper is a command-line tool that fetches the LeetCode Daily Challenge (or any specific problem) and saves it as well-formatted, language-specific source files β€” complete with problem description, difficulty, and starter code.

πŸ”“ Open Source | 🐹 Written in Go | πŸ“˜ GPL-3.0 Licensed


✨ Features

  • βœ… Fetches daily challenge or specific problem by slug
  • βœ… Outputs clean, readable source files with problem description
  • βœ… Supports multiple languages (Go, Python, Java, Rust, etc.)
  • βœ… Fully configurable with --flags or ~/.leetscraper.json
  • βœ… Clean CLI and GitHub Actions-based release automation

πŸ“¦ Installation

🐳 Download prebuilt binary

Precompiled binaries are available inside archives for major platforms:

Or visit the Releases page to download and verify checksums.

# Example (Linux):
curl -LO https://github.com/aaronlmathis/leetscraper/releases/latest/download/leetscraper-linux.tar.gz
tar -xzf leetscraper-linux.tar.gz
chmod +x leetscraper
./leetscraper --help

πŸ›  Or build from source:

git clone https://github.com/aaronlmathis/leetscraper.git
cd leetscraper
make build
./dist/leetscraper --help

πŸš€ Usage

➀ Daily Challenge (default)

Will default to pulling golang snippet, saving to working directory, using filename format: {id}-{difficulty}-{slug}.{ext} if .leetscraper.json is not present in home directory.

leetscraper

➀ Specific Problem by Slug

leetscraper --slug two-sum

➀ Custom Output Directory

leetscraper --out ~/leetcode/daily

➀ Multiple Languages

leetscraper --langs golang,python3,rust

➀ File Naming

leetscraper --format {id}-{difficulty}-{slug}.{ext}

βš™οΈ Configuration

Set your preferences (optional) via .leetscraper.json saved to home directory.

See leetscraper.json.sample for example.

~/.leetscraper.json:

{
  "outputDir": "/home/you/leetcode",
  "filenameFormat": "{id}-{difficulty}-{slug}.{ext}",
  "languages": ["golang", "python3"]
}

Command-line flags will override config file values.


πŸ“ Output Example

123-easy-two-sum.go
123-easy-two-sum.py
123-easy-two-sum.rs

Each file includes:

  • Problem title, difficulty, and link
  • Full problem description (Markdown)
  • Starter function in your language(s)

πŸ”§ Development

make build        # Build binary into dist/
make test         # Run integration tests
make release      # Cross-compile for release
make package      # Create .tar.gz and .zip archives

πŸ§ͺ Test Example

./test/test_leetscraper.sh

Or run as part of make test.


πŸ“œ License

GPL-3.0-or-later
Β© 2025 Aaron Mathis


⭐️ Star This Project

If this tool saves you time, consider ⭐ starring the repo β€” it helps more developers discover it!

About

Command-line tool to query leetcode for the daily coding challenge (or any problem by slug) and outputs the problem description and codesnippet (languages of your choice) into a file for solving locally.

License:GNU General Public License v3.0


Languages

Language:Go 79.9%Language:Makefile 11.3%Language:Shell 8.4%Language:Smarty 0.4%