You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add text HTTP transformers and HTML metadata utilities - #43
Adds the generic Hooksmith capabilities needed to compose HTML metadata enrichment without coupling provider integrations to page scraping.
@hooksmith/http
adds fetchText(...) for arbitrary-method text responses
adds getText(...) as the GET convenience transformer
mirrors the existing fetchJson/getJson transformer conventions
supports headers, arbitrary request bodies, mapping, and the existing non-2xx failure behavior
adds focused tests for GET, arbitrary methods/body mapping, and unsuccessful responses
New @hooksmith/html
Introduces the newly registered @hooksmith/html package for HTML parsing and metadata extraction utilities.
Initial surface:
OpenGraphMetadata
parseOpenGraph() — pure pipeline transformer from HTML text to metadata
getOpenGraph() — convenience transformer that fetches HTML through @hooksmith/http and parses the result
The initial Open Graph parser extracts:
og:title
og:description
og:image
og:url
og:type
og:site_name
It also falls back to <title> and meta[name=description], decodes common HTML entities, and resolves relative Open Graph image/URL values when a base URL is known.
Design boundary
The intended layering is:
@hooksmith/http -> transport / text retrieval
@hooksmith/html -> HTML interpretation / metadata extraction
provider package -> provider-specific serialization
This deliberately keeps Open Graph discovery out of social/provider packages such as @hooksmith/bluesky.
Compatibility
Existing HTTP APIs are unchanged. The new text transformers and HTML package are additive.
Avoid extracting metadata from comments and script content
extensions/html/mod.ts:80
Because this regex scans raw source rather than tokenizing HTML, it also matches <meta> text inside comments or script/string content. For example, a commented-out og:title before the real tag is stored first and wins, so pages with embedded examples can return incorrect metadata. Ignore comments/script blocks or use a DOM-aware parser before extracting tags.
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
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
Adds the generic Hooksmith capabilities needed to compose HTML metadata enrichment without coupling provider integrations to page scraping.
@hooksmith/httpfetchText(...)for arbitrary-method text responsesgetText(...)as the GET convenience transformerfetchJson/getJsontransformer conventionsNew
@hooksmith/htmlIntroduces the newly registered
@hooksmith/htmlpackage for HTML parsing and metadata extraction utilities.Initial surface:
OpenGraphMetadataparseOpenGraph()— pure pipeline transformer from HTML text to metadatagetOpenGraph()— convenience transformer that fetches HTML through@hooksmith/httpand parses the resultThe initial Open Graph parser extracts:
og:titleog:descriptionog:imageog:urlog:typeog:site_nameIt also falls back to
<title>andmeta[name=description], decodes common HTML entities, and resolves relative Open Graph image/URL values when a base URL is known.Design boundary
The intended layering is:
This deliberately keeps Open Graph discovery out of social/provider packages such as
@hooksmith/bluesky.Compatibility
Existing HTTP APIs are unchanged. The new text transformers and HTML package are additive.