feat: Add Google Drive image extraction support #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements support for extracting images from public Google Drive links, as requested in issue #13. The implementation now correctly handles both
/viewand non-/viewURL formats, converting them to direct download links.Changes Made
Core Functionality (
src/lib.js):convertGoogleDriveUrl()function to detect and convert Google Drive URLs to direct download formathttps://drive.google.com/file/d/{FILE_ID}/viewhttps://drive.google.com/file/d/{FILE_ID}https://drive.google.com/open?id={FILE_ID}Image Endpoint (
src/image.js):HTML Endpoint (
src/html.js):Markdown Endpoint (
src/markdown.js):Testing
Unit Tests (
tests/unit/convertGoogleDriveUrl.test.js):E2E Tests (
tests/e2e/google-drive.test.js):/viewand non-/viewformatsTest Results
All tests passing locally:
Specifically for Google Drive:
Verified Functionality
Tested with the exact URLs from issue #13:
https://drive.google.com/file/d/1Cxkx6-428EQAX0-eiaq66H829ohnPp7q/viewhttps://drive.google.com/file/d/1Cxkx6-428EQAX0-eiaq66H829ohnPp7q(without /view)https://drive.google.com/file/d/1fgJaftjv53xCN7vgiJOaQlbfWkUqPgyd/viewhttps://drive.google.com/file/d/1fgJaftjv53xCN7vgiJOaQlbfWkUqPgyd(without /view)All endpoints (
/image,/html,/markdown) correctly extract content from these URLs.Closes #13
🤖 Generated with Claude Code