Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderDiscovery does not work for WordPress #15

Open
manuels opened this issue Sep 24, 2011 · 3 comments
Open

ProviderDiscovery does not work for WordPress #15

manuels opened this issue Sep 24, 2011 · 3 comments
Labels

Comments

@manuels
Copy link

manuels commented Sep 24, 2011

The line of WordPress pages are not parsed correcty, I think.
It states:
<link rel="alternate" type="application/json+oembed" href="http://public-api.wordpress.com/oembed/1.0/?format=json&amp;url=https%3A%2F%2Fsweetandweak.wordpress.com%2F2011%2F09%2F23%2Fnothing-starts-the-morning-like-a-good-dose-of-panic%2F&amp;for=wpcom-auto-discovery"><link rel="alternate" type="application/xml+oembed" href="http://public-api.wordpress.com/oembed/1.0/?format=xml&amp;url=https%3A%2F%2Fsweetandweak.wordpress.com%2F2011%2F09%2F23%2Fnothing-starts-the-morning-like-a-good-dose-of-panic%2F&amp;for=wpcom-auto-discovery">

probably you just have to say
provider_endpoint ||= /<link.*href=['"]*([^\s'"]+)['"]*.*application\/json\+oembed.*>/.match(res.body)[0]
instead of
provider_endpoint ||= /<link.*href=['"]*([^\s'"]+)['"]*.*application\/json\+oembed.*>/.match(res.body)
in these lines: https://github.com/judofyr/ruby-oembed/blob/master/lib/oembed/provider_discovery.rb#L41

@manuels
Copy link
Author

manuels commented Sep 24, 2011

Oh, yes: If you need a page for testing this. It did not work for me for this page:
https://sweetandweak.wordpress.com/2011/09/23/nothing-starts-the-morning-like-a-good-dose-of-panic/

@metavida
Copy link
Collaborator

After writing some tests for OEmbed::ProviderDiscovery I've discovered that this is (to some extent) WordPress's fault for not following the oEmbed specification. According to WordPress's API documentation their oEmbed endpoint requires a for parameter with each request. In its current state, OEmbed::ProviderDiscovery isn't intelligent enough to pass along extra parameters like for, and so WordPress returns an error.

All that to say, this is still an open issue, but at least it's an understood issue now and has some decent test coverage available once a fix is written.

@manuels
Copy link
Author

manuels commented Sep 26, 2011

ok, good to know.
Thanks for ruby-oembed, btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants