A professional, cross-platform tool for downloading images and videos from NASA's media library. Features a modular architecture, desktop CLI, and Android APK support.
- Images: Download high-resolution space imagery in multiple quality levels
- Videos: Download space videos with intelligent quality detection
- Metadata: Save complete metadata as JSON and human-readable TXT files
- Quality Options: Small, Medium, Large, Original, or All qualities simultaneously
- Procedural Galaxy Animation: Mathematically-generated 5-arm spiral galaxy
- Nebula Overlay: Multi-octave noise-based cosmic clouds
- Flying UFO: Animated spacecraft with motion effects
- Enhanced Starfield: Twinkling stars with shooting star effects
- Adaptive Throttling: Automatically adjusts download speed to avoid rate limits
- Concurrent Downloads: Multi-threaded downloads (1-12 workers)
- Smart Retry Logic: Automatic retry with exponential backoff
- Progress Tracking: Real-time progress bars
- Security: Input sanitization, path traversal prevention, HTTPS-only
- Cross-Platform: Desktop CLI and Android APK support
nasa-media-downloader/
├── src/nasa_downloader/ # Main package
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── core/ # Configuration, models, exceptions
│ │ ├── config.py
│ │ ├── models.py
│ │ └── exceptions.py
│ ├── api/ # NASA API client
│ │ ├── client.py
│ │ ├── session.py
│ │ └── quality.py # Intelligent quality detection
│ ├── downloader/ # Download engine
│ │ ├── engine.py
│ │ ├── throttle.py
│ │ ├── tasks.py
│ │ └── metadata.py # Fixed metadata saving
│ ├── cli/ # Command-line interface
│ │ ├── app.py # Click-based CLI
│ │ └── prompts.py
│ └── ui/ # Terminal UI
│ ├── terminal.py
│ ├── starfield.py
│ ├── intro.py
│ └── themes.py
├── android/ # Android/Kivy app
│ ├── main.py
│ ├── buildozer.spec
│ └── nasa_downloader.kv
├── tests/ # Test suite
├── .github/workflows/ # CI/CD
│ └── build-apk.yml
├── pyproject.toml
├── requirements.txt
└── requirements-dev.txt
# Clone the repository
git clone https://github.com/your-username/nasa-media-downloader.git
cd nasa-media-downloader
# Install dependencies
pip install -r requirements.txt
# Or install as package
pip install -e .The APK is automatically built via GitHub Actions. Download from the Actions tab or build locally:
cd android
pip install buildozer
buildozer android debugpython -m nasa_downloader interactiveOr simply:
python -m nasa_downloaderThis launches the full experience with animations and interactive prompts.
For automation and scripts:
# Download Mars images
python -m nasa_downloader download --query "mars" --limit 50 --quality orig
# Download ISS videos with metadata
python -m nasa_downloader download --query "ISS" --videos --metadata --quality large
# Download all qualities
python -m nasa_downloader download --query "nebula" --images --videos --quality all --limit 100python -m nasa_downloader download [OPTIONS]
Options:
-q, --query TEXT Search query (required)
-o, --output PATH Output directory
-Q, --quality TEXT Quality: 1=small, 2=medium, 3=large, 4=orig, 5=all
-n, --limit INT Maximum items to download
--rate FLOAT Delay between requests (default: 1.0)
--workers INT Concurrent download threads (default: 6)
--min-workers INT Minimum workers for adaptive mode (default: 1)
--max-workers INT Maximum workers for adaptive mode (default: 12)
--no-adaptive Disable adaptive throttling
--images/--no-images Download images (default: yes)
--videos/--no-videos Download videos (default: no)
--metadata/--no-metadata Save metadata files (default: yes)python -m nasa_downloader interactive [OPTIONS]
Options:
--skip-intro Skip the intro animation
--rate FLOAT Delay between requests
--workers INT Concurrent download threadsNASA-Downloads/
└── your_search_query/
├── mission_manifest.json
├── logs/
│ └── nasa_downloader.log
├── Images/
│ ├── Low/
│ │ ├── Files/
│ │ └── Metadata/
│ ├── Medium/
│ ├── High/
│ └── Original/
└── Videos/
├── Low/
├── Medium/
├── High/
└── Original/
| Quality | CLI Option | Description |
|---|---|---|
| Small | 1 or small |
Low resolution, fast downloads |
| Medium | 2 or medium |
Balanced quality and size |
| Large | 3 or large |
High resolution |
| Original | 4 or orig |
Best quality, largest files |
| All | 5 or all |
All 4 quality levels |
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Format code
black src/
ruff check src/
# Type checking
mypy src/# Run all tests
pytest
# Run with coverage
pytest --cov=nasa_downloader --cov-report=html
# Run specific test file
pytest tests/test_quality.pyProblem: Metadata was only saved to the first quality directory Fix: Now saves metadata to ALL selected quality directories
Problem: Simple string matching failed on many video URLs Fix: Implemented intelligent scoring system based on:
- Resolution patterns (1080p, 720p, 480p)
- Quality keywords (orig, master, preview)
- Fallback to best available
This tool uses the NASA Images and Video Library API:
- Endpoint:
https://images-api.nasa.gov - No API Key Required: Completely free and public
- Content: 140,000+ images and videos
- Reduce workers:
--workers 3 - Increase rate limit:
--rate 2.0
- The adaptive throttling handles this automatically
- Or use:
--workers 2 --max-workers 4 --rate 2.0
- Use a modern terminal (Windows Terminal, iTerm2)
- Or use
--skip-introflag
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Run tests:
pytest - Submit a pull request
MIT License - Feel free to use, modify, and distribute.
- NASA Images API: For free access to incredible space media
- Python Community: For amazing libraries
- Contributors: Everyone who helps improve this tool
Happy downloading, space explorer!
╭───╮
╱ ◉ ◉ ╲
╱───────╲
▔▔▔▔▔▔▔▔▔▔