(url: string, type?: string)
| 136 | }; |
| 137 | |
| 138 | const 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 | |
| 155 | async function getEmbedResponse({ |
| 156 | url, |
no test coverage detected