Repository navigation
v0.3.3 - Complete Google Drive Download Support
π Major Release: Full Google Drive Support
This release fixes critical bugs and adds comprehensive support for all Google Drive file types including Google Workspace documents.
β¨ Highlights
π Critical Bugs Fixed
- Stream double-consumption bug - Downloads were getting HTML preview pages instead of actual files
- Form parsing bug - Processing HTML line-by-line broke multi-line forms
- Language localization bug - Google Docs titles were localized, breaking detection
- HTTP 500 handling - Now properly retries for Google Workspace documents
π New: Auto URL Conversion
No more --fuzzy flag needed! Standard Google Drive URLs just work:
# All of these work automatically now
./bin/gdown 'https://drive.google.com/file/d/ID/view'
./bin/gdown 'https://docs.google.com/document/d/ID/edit'
./bin/gdown 'https://docs.google.com/spreadsheets/d/ID/edit'π Google Workspace Export
Full support for exporting Google Docs, Sheets, and Slides:
- Google Docs β DOCX (default) or PDF
- Google Sheets β XLSX (default)
- Google Slides β PPTX (default)
# Download as DOCX (default)
./bin/gdown 'https://docs.google.com/document/d/ID/edit'
# Download as PDF
./bin/gdown 'https://docs.google.com/document/d/ID/edit' --format pdfπ‘οΈ Smart Error Detection
- Detects Google Drive error/preview pages
- Prevents downloading HTML garbage
- Still allows legitimate HTML files
- Clear error messages
π§ͺ Test Suite
32 tests, 84 assertions, all passing
Integration Tests
Comprehensive tests with permanent public Google Drive links:
- β Small file (4 bytes)
- β Large file (100MB)
- β HTML file
- β Folder with PDFs
- β Google Doc (DOCX + PDF)
- β Google Sheet (XLSX)
- β Google Slides (PPTX)
All tests use real downloads, no mocks!
π¦ Installation
composer require zupolgec/gdown-phpπ Usage
PHP Library
use Zupolgec\GDown\GDown;
use Zupolgec\GDown\FolderDownloader;
// Download file
GDown::download(
url: 'https://drive.google.com/file/d/FILE_ID/view',
output: 'file.pdf'
);
// Download Google Doc as DOCX
GDown::download(
url: 'https://docs.google.com/document/d/DOC_ID/edit',
output: 'document.docx'
);
// Download Google Doc as PDF
GDown::download(
url: 'https://docs.google.com/document/d/DOC_ID/edit',
output: 'document.pdf',
format: 'pdf'
);
// Download folder
$downloader = new FolderDownloader();
$result = $downloader->downloadFolder(
url: 'https://drive.google.com/drive/folders/FOLDER_ID'
);CLI Tool
# Download file (no --fuzzy needed!)
./bin/gdown 'https://drive.google.com/file/d/FILE_ID/view'
# Download folder
./bin/gdown --folder 'https://drive.google.com/drive/folders/FOLDER_ID'
# Download Google Doc as PDF
./bin/gdown 'https://docs.google.com/document/d/DOC_ID/edit' --format pdf
# Get file info
./bin/gdown --info 'https://drive.google.com/file/d/FILE_ID/view'π§ What Changed
Files Modified
src/Downloader.php- All core fixessrc/UrlParser.php- Removed misleading warningtests/IntegrationTest.php- New comprehensive teststests/DownloaderTest.php- Fixed risky test
Technical Details
- Read response body only once (prevent double consumption)
- Process entire HTML document (not line-by-line)
- Auto-convert /file/d/ URLs to /uc?id= format
- Force English with ?hl=en for Google Workspace
- Disable Guzzle HTTP exceptions for proper retry logic
- Smart error page detection with multiple checks
π Comparison to Python gdown
| Feature | Python gdown | GDown-PHP v0.3.3 |
|---|---|---|
| File downloads | β | β |
| Large files (>100MB) | β | β |
| Folder downloads | β | β |
| Google Docs export | β | β |
| Google Sheets export | β | β |
| Google Slides export | β | β |
| Auto URL conversion | β | β |
| File info preview | β | β Unique! |
| Integration tests | β | β New! |
π Acknowledgments
Special thanks for manual testing that caught critical bugs automated tests missed!
π Full Changelog
v0.3.2...v0.3.3