Repository navigation
Using oEmbed With Unknown Providers
Use Wrapper.GetContent for a URL that is not automatically routed to a known provider. The wrapper first checks explicit provider routing; if no active pattern matches, it performs standards-based unauthenticated JSON discovery.
using WillStrohl.API.oEmbed;
var request = new RequestInfo("https://example.com/article/123", 800, 600);
var output = new Wrapper().GetContent(request);The resource response may advertise an oEmbed endpoint in either location:
<link rel="alternate"
type="application/json+oembed"
href="/oembed?resource=article-123" />The rel value must include alternate, the type must be application/json+oembed, and the href must resolve to an HTTP or HTTPS URL. Relative endpoints are resolved against the resource URL.
Link: </oembed?resource=article-123>; rel="alternate"; type="application/json+oembed"The implementation accepts the same JSON oEmbed type from HTTP Link metadata. HTML metadata is examined before response headers.
The discovered endpoint is called with JSON oEmbed parameters:
-
url: the original resource URL, URL-encoded. -
format=json. -
maxwidth: included whenRequestInfo.MaxWidthis greater than-1. -
maxheight: included whenRequestInfo.MaxHeightis greater than-1.
Existing endpoint query parameters are preserved. URL fragments are removed from the endpoint request.
Discovery parses standard JSON responses into the existing response models:
photovideorichlink
For a discovered link response, Wrapper.GetContent returns the response title. Video and rich responses pass through the same safe HTML transformation used by known providers.
XML discovery, authenticated discovery, and proprietary provider metadata are intentionally unsupported.
Discovery returns an unsupported-provider error when:
- The resource URL is not absolute HTTP/HTTPS.
- No valid JSON oEmbed link is advertised.
- The discovered endpoint is not HTTP/HTTPS.
- The response is malformed JSON.
- The response type is unsupported.
- The security policy blocks the resource, endpoint, DNS result, or redirect.
Applications should treat provider failures as expected remote-service failures and provide an appropriate fallback UI.
The repository’s tests use local or mock responses rather than live provider calls. Follow the project’s MSBuild and test instructions in Development and release.
This innovation is maintained by Upendo Ventures. Demos of this software can be seen on various runsonUpendo client websites.