feat: Implement Bluesky card previews without additional dependencies#164
Draft
feat: Implement Bluesky card previews without additional dependencies#164
Conversation
Co-authored-by: nzakas <38546+nzakas@users.noreply.github.com> Agent-Logs-Url: https://github.com/humanwhocodes/crosspost/sessions/9d7c6363-e478-4866-9d62-d3e1ecf8091a
Co-authored-by: nzakas <38546+nzakas@users.noreply.github.com> Agent-Logs-Url: https://github.com/humanwhocodes/crosspost/sessions/9d7c6363-e478-4866-9d62-d3e1ecf8091a
Copilot created this pull request from a session on behalf of
nzakas
March 25, 2026 19:41
View session
Co-authored-by: nzakas <38546+nzakas@users.noreply.github.com> Agent-Logs-Url: https://github.com/humanwhocodes/crosspost/sessions/e05f7b80-f4d0-4f40-85e6-4c04995e99ce
Contributor
Author
Done in bc80408. Regarding images: per the AT Protocol lexicon for |
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.
When a post contains URLs but no images, the Bluesky strategy now automatically fetches Open Graph metadata from the first URL and creates an embed card (
app.bsky.embed.external). Thumbnail images are fetched and uploaded when available. Failures are silently ignored so posts still succeed without card previews.Implements the same feature as #162 but without adding any new dependencies — uses a regex-based HTML parser instead of
metascraper.Changes
src/strategies/bluesky.js:BLUESKY_URL_FACETconstant (already exported frombluesky-facets.js)parseOpenGraphData(html)— extractsog:title,og:description,og:imagefrom HTML via regex; falls back to the<title>element whenog:titleis absentfetchOpenGraphData(url, signal)— fetches a URL and returns parsed OG metadatacreateCardEmbed(options, session, facets, signal)— builds anapp.bsky.embed.externalobject from the first URL facet, uploading thumbnail when presentpostMessage: addelsebranch to auto-generate card embed when no images are providedtests/strategies/bluesky.test.js:externalServerMockServer forhttps://example.comand register withFetchMockerdescribe("post with auto card preview", ...)with 5 tests:<title>as fallback whenog:titleis not presentRelates to #161
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.