feat: extract hashtags from messages and photo captions as bookmark tags - #15
Merged
Conversation
…rk tags Hashtags written in a Telegram message or photo caption are now attached to the created Karakeep bookmark as human tags, alongside the existing #telegram tag. Tag attachment is batched into a single API call with a properly JSON-encoded payload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Hashtags written in a Telegram message text or photo caption are now attached to the created Karakeep bookmark as human tags, alongside the existing
#telegramtag.TelegramMessage.Hashtags()extracts unique hashtags from both the message text and photo caption using a unicode-aware regex (e.g.#путешествия,#日本語work), returning names without the leading#.enrichBookmarkattaches these hashtags together with the#telegramtag; since enrichment runs for every bookmark type, this covers photo, text, link, and forwarded-channel bookmarks uniformly.AddTagwithAddTags: all tags are sent in a single API call, and the payload is built withjson.Marshalinstead of string formatting, so tag names with special characters can't break the JSON.Test plan
telegram_message_test.gocovering hashtags in text, in captions, deduplication, unicode tags, underscores/digits, and bare#edge cases.go build ./...,go vet, andgo test ./...all pass.