Leveraging oembed for dynamic content integration with SoundCloud in JSON

I'm looking to retrieve the latest 10 tracks of a user using oembed with json.

$.getJSON("http://soundcloud.com/oembed", 
          {url: "https://soundcloud.com/aviciiofficial", format: "json"},
function(data)
{
    console.log(data.html);
})

The data.html output includes all the user's track set within the SoundCloud player. However, I want to access the tracks individually (similar to data[0].html). Is there a way to fetch an array of the newest tracks?

Console output:

<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fusers%2F1861068"></iframe>

Thank you!

Answer №1

To retrieve a user's tracks, you will need to send an API request as there is no specific oembed endpoint that provides a list of embeds.

UPDATE:

In order to display the artwork widgets, you must loop through the array and replace the API_URL and COLOR with each item's API URL and desired color (you could potentially set the color universally for all).

'<object height="300" width="300">' + 
  '<param name="movie" value="https://player.soundcloud.com/player.swf?url={{API_URL}}&amp;color={{COLOR}}&amp;auto_play=false&amp;player_type=artwork">' +      
  '</param>' +
  '<param name="allowscriptaccess" value="always"></param>' +
  '<embed allowscriptaccess="always" width="300" height="300" ' + 
    'src="https://player.soundcloud.com/player.swf?url={{API_URL}}&amp;color={{COLOR}}&amp;auto_play=false&amp;player_type=artwork" ' +
    'type="application/x-shockwave-flash">' + 
  '</embed>' + 
'</object>';

This method was previously discussed in detail in the answer found here: Retrieve Soundcloud search results and embed results, focusing on HTML5 widget implementation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

a guide on incorporating an input parameter into a form with the help of jQuery

$('form').submit(function(){ this.action="http://www.website.com/post"; return false; }); In the process of adjusting the action attribute of the form, I am considering adding an additional input parameter to it. ...

Using jQuery to pass dynamic values to a plugin function

I'm currently utilizing the JSONTable plugin and attempting to dynamically pass values to the 'head' and 'json' parameters by extracting them from an array object. For instance, I aim to load a new json file, convert it to a JavaSc ...

What is the method by which a server sends data to a client in long polling without the client

My current method of requesting data from the server via ajax in intervals feels too easy and lazy for achieving real-time effects. I am now considering switching to long polling or comet techniques because they encourage the server to push data when avai ...

Dynamic content loading using AJAX to selectively update a designated section

I am having trouble displaying the error message in my form. Currently, it is causing my form page to load four times. Can someone help me identify what I did wrong? I only want to display that span: controllers: <?php /* * File Name: user.php */ ...

Tips for returning an element to its starting position following animation

Hey there, I’m fairly new to the world of HTML and CSS. Recently, I was working on creating a YouTube clone website and I’ve run into an issue with the navigation. On the official YouTube website, when you click on the hamburger menu icon, the naviga ...

jQuery droppable: Encounter of an unexpected TypeError: undefined lacks the characteristics of a function

I'm trying to implement drag and drop functionality on my website. However, I am encountering an error message in the console that says: Uncaught TypeError: undefined is not a function ... presentation-categories.js?version=1:23. The error occurs at ...

Analyzing the path of the cursor

Looking to enhance my tracking capabilities by monitoring mouse movements. I have the ability to capture XY coordinates, but understand that they may vary depending on browser size. Are there any other parameters recommended for accurate results? P.S: Be ...

Incorporating PayUMoney into MVC and utilizing ajax for seamless integration

Whenever the user clicks on a button, I want them to be redirected to the PayUMoney gateway. If the payment is successful, then the user's data should be stored in the database and they should be redirected to a success page. Otherwise, they should be ...

Automatically populate a dropdown menu with options based on the user's birth date

I successfully managed to populate the drop-down fields for months, days, and years. Furthermore, I was able to calculate the age of the user; however, I have restricted it to a maximum of 13 years. Check out the code snippet below: $('#reg-yr' ...

Transferring JSON data back and forth between C# and PHP files

I am trying to send a JSON request from C# to a PHP file in order to save data into a text file. However, the PHP file is unable to read the data. Below is my code: User user = new User { id = 1, name = "Bob", address = "password", phone = "0111111111", a ...

Having trouble passing $scope, $route, or $http in your AngularJS factory functions?

Why does my factory keep throwing an error when the $scope, $route, $http are present? app.factory("factoryContacts",function($scope,$route,$http){ return { getContacts: function(){ return $http({ me ...

Developing a Web service in .NET 4.0 for fetching JSON data on Android devices

Currently, I am without any code at hand. My task involves building a webservice that can retrieve data from a database in JSON format to be used in an Android application. I'm feeling a bit lost on how to get started with this project. Any guidance o ...

A more efficient approach to creating a personalized design

After realizing the original question was unclear and wouldn't solve my problem, I have decided to edit it and create a new one. For my project, I require a customized layout where users can move, resize, add, or remove each box according to their pr ...

Exploring methods to identify the initial value for JSON decoding in Swift

I have been working on decoding a JSON tree in Swift and below is an example of what the JSON tree looks like: { "_type" = News; queryContext = { originalQuery = ""; }; readLink = "https://api.cognitive.microsoft.com/api/v7/new ...

Instructions on calculating the sum of a checkbox value and a textbox value

Here, my goal is to dynamically calculate the total value of selected checkboxes (Checkbox1 and Checkbox3) with the value in TextBox1, and then display the sum in TextBox2 without the need for any button click event. <div> <asp:Tex ...

jQuery plugin stops functioning properly following the use of the jQuery display block method

In my project, I am exploring the use of divs as tabs with jQuery. Within these divs, I also want to incorporate another jQuery plugin. Currently, I have manually created these div tabs using jQuery and set the default style for second and subsequent divs ...

Is there a way to display multiple images in a JSON message object?

If you're looking for a fun way to generate random dog images, then check out my DogAPI image generator! Simply enter a number between 1-50 into the form text box, hit send, and watch as it displays that amount of random dog photos. I'm almost t ...

Retrieve information using AJAX via POST method

I find myself in a bit of a pickle at the moment. I've been researching for hours, and I still can't seem to figure out this seemingly basic issue. It would be greatly appreciated if someone could offer me some quick advice. So here's my dil ...

Tips for accessing JSON data nested within another JSON object

Above is the JSON data I have: { "RestResponse" : { "messages" : [ "More webservices are available at http://www.groupkt.com/post/f2129b88/services.htm", "Total [249] records found." ], "result" : [ { "name" : "Afghanistan", "alpha2_ ...

Is there a way to enable text selection on a jQuery draggable div?

I utilized jQuery to make a specific div draggable, but I've encountered an issue. Inside this draggable box, there is some important text that I need to be able to copy and paste. However, whenever I click on the box, it triggers the dragging action ...