leedo / noembed

oEmbed gateway service with additional non-oEmbed sources
http://www.noembed.com
481 stars 90 forks source link

oembed support in phorkie pastes not detected #49

Closed cweiske closed 9 years ago

cweiske commented 9 years ago

phorkie, my pastebin software, supports oembed autodiscovery - see http://p.cweiske.de/158:

  <link rel="alternate" title="oEmbed" type="application/json+oembed" href="http://p.cweiske.de/oembed.php?format=json&amp;url=http%3A%2F%2Fp.cweiske.de%2F158"/>
  <link rel="alternate" title="oEmbed" type="application/xml+oembed" href="http://p.cweiske.de/oembed.php?format=xml&amp;url=http%3A%2F%2Fp.cweiske.de%2F158"/>

The noembed demo still says "no matching providers found".

brycied00d commented 9 years ago

That's because noembed doesn't support (or use in any way) oembed autodiscovery. Every "provider" (https://github.com/leedo/noembed/tree/master/lib/Noembed/Provider) defines a regex for URLs it can handle, and that's how noembed "knows" what sites it supports and how to support them.

Adding support for your own site is exceedingly easy. Copy an existing oembed-based provider, adjust the regex, names, URLs etc as necessary, and submit a pull request.

For example, here's a very simple provider that uses a site's own oembed endpoint: https://github.com/leedo/noembed/blob/master/lib/Noembed/Provider/ADN.pm (c5aa29b15ae2696708dd6983869a8fbbad6f10da)

cweiske commented 9 years ago

phorkie is a self-hosted pastebin that everyone can host on his own server/domain. With that it makes no sense to hard-code support for only my specific domain.

leedo commented 9 years ago

I wasn't familiar with oEmbed autodiscovery. It's an interesting idea, but I'm not entirely sure it makes sense for noembed to support it by default. Maybe it could be an optional provider that matches every URL. I don't think I would enable that on the noembed.com install though, because I suspect it would end up using a lot of bandwidth checking every URL for the relevant HTML tags.

leedo commented 9 years ago

Another option would be a query parameter that indicates auto-discovery should be used. I'd just like to avoid checking every URL for autodiscovery support.