I'm trying to use python-oembed
library to get oembed comment from reddit(https://github.com/reddit/reddit/wiki/oEmbed):
import oembed
consumer = oembed.OEmbedConsumer()
endpoint = oembed.OEmbedEndpoint('https://www.reddit.com/oembed',['https://www.reddit.com/r/*'])
consumer.addEndpoint(endpoint)
response = consumer.embed('https://www.reddit.com/r/Showerthoughts/comments/2safxv/we_should_start_keeping_giraffes_a_secret_from/cno7zic')
And get oembed.OEmbedError: Missing required fields on OEmbed rich response.
error.
How can I retreive this data?
The oembed returned by reddit is invalid.
From http://oembed.com/, §2.3.4.4, width
and height
are required for the rich
type.
But, from the reddit sample, we see that reddit doesn't supply a width
nor height
value.
You might need to get reddit to fix their broken oembed implementation, or you might want to use more forgiving library.