transformer-oembed icon indicating copy to clipboard operation
transformer-oembed copied to clipboard

`{format}` parameter in oembed URL is not replaced by actual format (json)

Open vlisivka opened this issue 4 years ago • 1 comments

  • @remark-embedder/transformer-oembed version: 1.0.1
  • node version: v14.17.0
  • npm version: 6.14.13

Problem description:

This plugin doesn't replace {format} parameter in oembed URL.

Expected URL:

https://vimeo.com/api/oembed.json?URL

Actual URL:

https://vimeo.com/api/oembed.%7Bformat%7D?URL

Error message:

(node:169898) UnhandledPromiseRejectionWarning: FetchError: The following error occurred while processing `https://vimeo.com/66520064` with the remark-embedder transformer `@remark-embedder/transformer-oembed`:

invalid json response body at https://vimeo.com/api/oembed.%7Bformat%7D?url=https%3A%2F%2Fvimeo.com%2F66520064&maxwidth=640&maxheight=480&format=json reason: Unexpected token < in JSON at position 0
    at /home/vlisivka/workspace/vlisivka.github.io/node_modules/minipass-fetch/lib/body.js:77:31
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.getHTML (/home/vlisivka/workspace/vlisivka.github.io/node_modules/@remark-embedder/transformer-oembed/dist/index.js:87:18)
    at async /home/vlisivka/workspace/vlisivka.github.io/node_modules/@remark-embedder/core/dist/index.js:106:20
    at async Promise.all (index 8)
    at async /home/vlisivka/workspace/vlisivka.github.io/node_modules/@remark-embedder/core/dist/index.js:158:5

Suggested solution:

Replace {format} by json.

vlisivka avatar Jul 29 '21 06:07 vlisivka

Hi @vlisivka,

Thanks for the issue. If you'd like to dig a little deeper into things and make a pull request that'd be great. Thanks!

kentcdodds avatar Jul 29 '21 23:07 kentcdodds