jacktuck / unfurl

Metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js :zap:
MIT License
474 stars 51 forks source link

fix: support for CDATA in oembed #98

Closed jacktuck closed 1 year ago

jacktuck commented 1 year ago

Test

❯ curl "https://unfurljs.herokuapp.com/?url=https://soundcloud.com/the-bugle" -s | jq '.oEmbed'
{
  "version": "1.0",
  "type": "rich",
  "height": 450,
  "width": 100,
  "title": "The Bugle",
  "html": "<iframe width=\"100%\" height=\"450\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true&url=https%3A%2F%2Fapi.soundcloud.com%2Fusers%2F9818871&show_artwork=true\"></iframe>"
}
jacktuck commented 1 year ago

@adrian-seijo let me know what you think. I couldn't resist some refactoring so I'll comment on the relevant line changes.

adrian-seijo commented 1 year ago

src/index.ts

Definetively a better approach, love that 5 major version bump of the parser 😜 Thanks for the release!