Closed wvyeun closed 7 years ago
Hey @wvyeun! I'm not sure if the problem you are having related to oEmbed or this library. If I understood everything correctly, the problem is with the response you get from SoundCloud.
Anyway! I'll try to help you. [Documentation for SoundCloud oEmbed endpoint] uses HTTP in the example, but I decided to try HTTPS instead:
curl "https://soundcloud.com/oembed" \
-d 'format=json' \
-d 'url=https://soundcloud.com/forss/flickermood'
I got response, but URL in the thumbnail_url
field still had HTTP:
{
"version": 1,
"type": "rich",
"provider_name": "SoundCloud",
"provider_url": "http://soundcloud.com",
"height": 400,
"width": "100%",
"title": "Flickermood by Forss",
"description": "From the Soulhack album, recently featured in this ad <a href=\"https://www.dswshoes.com/tv_commercial.jsp?m=october2007\">https://www.dswshoes.com/tv_commercial.jsp?m=october2007</a> ",
"thumbnail_url": "http://i1.sndcdn.com/artworks-000067273316-smsiqx-t500x500.jpg",
"html": "<iframe width=\"100%\" height=\"400\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true\"></iframe>",
"author_name": "Forss",
"author_url": "https://soundcloud.com/forss"
}
But! Nothing stops you from trying HTTPS anyway 😉 Turned out SoundCloud CDN serves both HTTP and HTTPS, so both URLs works:
Summary
You need to make one extra step and replace http
with https
, when you receive response from SoundCloud, then the problem will be solved.
Thank you for your assistance! With ror I used
@avatar = @artist.fetch(@artist.image)['thumbnail_url'].sub('http:', '')
Hi @soulim :) I'm using oembed for my project but I noticed that when I want to grab the thumbnail url for Soundcloud it returns a http image so whenever the image loads on my website in the log it says mixed content and that the image should also be served over HTTPS. Is there a way to fix this? Thanks! Christle