MCPcopy Create free account
hub / github.com/hashintel/hash / getOembedEndpoint

Function getOembedEndpoint

apps/hash-api/src/graphql/resolvers/embed/index.ts:138–153  ·  view source on GitHub ↗
(url: string, type?: string)

Source from the content-addressed store, hash-verified

136};
137
138const getOembedEndpoint = (url: string, type?: string) => {
139 for (const { provider_name, endpoints } of oEmbedData as IoEmbedData[]) {
140 if (type && provider_name !== type) {
141 continue;
142 }
143 for (const endpoint of endpoints) {
144 const isMatch = !!endpoint.schemes?.find((scheme) =>
145 scheme.split("*").every((substring) => url.includes(substring)),
146 );
147
148 if (isMatch) {
149 return endpoint.url;
150 }
151 }
152 }
153};
154
155async function getEmbedResponse({
156 url,

Callers 1

getEmbedResponseFunction · 0.85

Calls 2

splitMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected