UNPKG

@udus/notion-renderer

Version:
28 lines (27 loc) 864 B
import { fetchOembed } from "../../../utils/oembed.js"; import { convertResponseToRichText } from "../../richText/richText.js"; export const convertVideoResponseToBlock = async (block, client) => { if (block.video.type === "external") { const { ok, data } = await fetchOembed(block.video.external.url, { maxwidth: 560, maxheight: 315, }); if (ok) { return { ...block, video: { ...block.video, caption: await convertResponseToRichText(block.video.caption, client), oembed: data, }, }; } } return { ...block, video: { ...block.video, caption: await convertResponseToRichText(block.video.caption, client), }, }; };