# HG changeset patch # User Brian Neal # Date 1426474113 18000 # Node ID 344f7914d42168e10be0c481b1409faba6506001 # Parent be233ba7ca3129c954c1781c6a3e4191163972d9 Add scheme=https to oembed request. YouTube added this so you could get HTML that used https to embed the video. It seems that Vimeo also supports it. diff -r be233ba7ca31 -r 344f7914d421 oembed/core.py --- a/oembed/core.py Sun Mar 08 11:06:07 2015 -0500 +++ b/oembed/core.py Sun Mar 15 21:48:33 2015 -0500 @@ -52,6 +52,7 @@ if __name__ == "__main__": try: print get_oembed("http://www.youtube.com/oembed", - "http://www.youtube.com/watch?v=7_IMzJldOf4") + "http://www.youtube.com/watch?v=7_IMzJldOf4", + scheme='https') except urllib2.HTTPError, e: print e diff -r be233ba7ca31 -r 344f7914d421 oembed/views.py --- a/oembed/views.py Sun Mar 08 11:06:07 2015 -0500 +++ b/oembed/views.py Sun Mar 15 21:48:33 2015 -0500 @@ -43,23 +43,24 @@ if re.match(provider.url_regex, url): try: data = get_oembed(provider.api_endpoint, - url, - maxwidth=settings.OEMBED_MAXWIDTH, - maxheight=settings.OEMBED_MAXHEIGHT) + url, + maxwidth=settings.OEMBED_MAXWIDTH, + maxheight=settings.OEMBED_MAXHEIGHT, + scheme='https') except IOError, e: return HttpResponseBadRequest( "Sorry, we could not retrieve your video (%s)" % e) - if 'type' not in data or data['type'] != 'video': + if data.get('type') != 'video': return HttpResponseBadRequest( "Hey, this doesn't look like a video..??") oembed = Oembed(url=url, - type=Oembed.VIDEO, - title=data.get('title', ''), - width=int(data.get('width', 0)), - height=int(data.get('height', 0)), - html=data.get('html', '')) + type=Oembed.VIDEO, + title=data.get('title', ''), + width=int(data.get('width', 0)), + height=int(data.get('height', 0)), + html=data.get('html', '')) oembed.save() data = dict(id=oembed.id, embed=oembed.html)