Skip to content

Conversation

@digithree
Copy link
Owner

Summary

Adds comprehensive tagging support to the Karakeep export functionality, allowing tags from Pocket bookmarks to be automatically transferred to Karakeep during export.

Key Features

  • Tag fetching: Retrieves existing tags from Karakeep API for efficient matching
  • Smart tag handling: Reuses existing tag IDs when available, generates random IDs for new tags
  • Robust parsing: Handles Pocket's nested JSON tag format and fallback formats
  • Backward compatibility: Works seamlessly with databases that don't have tags

Implementation Details

  • Enhanced KarakeepClient with get_all_tags() and add_tags_to_bookmark() methods
  • Added tag caching to minimize API calls during export sessions
  • Updated export logic to parse tags from existing database column
  • Graceful handling for databases with/without tags column
  • Comprehensive debug logging for troubleshooting

API Integration

  • Fetches tags via /api/v1/tags endpoint
  • Attaches tags via /api/v1/bookmarks/:bookmarkId/tags endpoint
  • Follows Karakeep API specifications for tag ID and name structure

Testing

  • All existing tests continue to pass
  • Added comprehensive error handling for edge cases
  • Validated tag parsing with various input formats

🤖 Generated with Claude Code

digithree and others added 3 commits May 25, 2025 22:12
- Enhanced KarakeepClient with get_all_tags() and add_tags_to_bookmark() methods
- Added tag caching and automatic ID generation for new tags
- Updated export logic to parse existing tags column and attach to Karakeep bookmarks
- Added graceful handling for databases with/without tags column
- Maintains backward compatibility with existing functionality
- All tests passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed tag parsing to properly handle Pocket's nested JSON format: {"tag_name": {"tag": "tag_name", "item_id": "123"}}
- Extract tag names from the nested 'tag' field within each tag object
- Maintain fallback to key names if nested structure not found
- Updated comments with appropriate examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add logging to show tags_data from database for each item
- Add logging to show parsed tag names and count
- Add specific logging for items with no tags vs no bookmark_id
- Help troubleshoot tag processing during export

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@digithree digithree merged commit 56d0d86 into main May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants