Update for 2019...
This builds off of blueiur's answer and walks through a solution in more detail. JSDOMneeds to be installed before you can use it:
npm install jsdom
Now, according to the documentation, you can instantiate JSDOM like this:
const jsdom = require('jsdom');
const { JSDOM } = jsdom;
You've already got some html you want to parse, I'll use your example and define it as a template literal:
const data = `<iframe width="100%" height="166" scrolling="no" frameborder="no"
src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F11111111&auto_play=false
&show_artwork=true&color=c3000d&show_comments=false&liking=false
&download=false&show_user=false&show_playcount=false"></iframe>`;
Here's the fun part... parse the html in NodeJS:
const { document } = (new JSDOM(data)).window;
What's happening here? You're creating a new JSDOM object with the provided HTML and grabbing the document attribute of the window attribute. From this point on, you can use document.getElementsByTagName() and other similar functions just like you would in a browser.
To continue with your specific example, you want to extract the src attribute of the only iframe in the document. There are multiple ways to do that. One example is to use getElementsByTagName to pull the first iframe like this:
const src1 = document.getElementsByTagName('iframe')[0].src;
Now that we have the src attribute, we can split it apart and process the url query value. This is where we will use the URL class which comes with NodeJS. According to the documentation, we can get the search parameters by creating a URL object and accessing the searchParams attribute like this:
const params = (new URL(src1)).searchParams;
Now you've got the query string as a URLSearchParams object and you can access individual terms like this:
const scURL = params.get('src');
If you look at the contents of scURL now, you'll find it is the embedded url which was passed as a query, so we can parse that with another URL object and extract the pathname attribute like this:
const src2 = (new URL(src2)).pathname;
We're getting close now, and can split the path apart to the get value you wanted using JavaScript's standard string functions:
const val = src2.split('/')[2];
And print the result:
console.log(val);
... which produces this output:
11111111
To summarize, here is the complete code:
const jsdom = require('jsdom');
const { JSDOM } = jsdom;
const data = `<iframe width="100%" height="166" scrolling="no" frameborder="no"
src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F11111111&auto_play=false
&show_artwork=true&color=c3000d&show_comments=false&liking=false
&download=false&show_user=false&show_playcount=false"></iframe>`;
const { document } = (new JSDOM(data)).window;
const src1 = document.getElementsByTagName('iframe')[0].src;
const params = (new URL(src1)).searchParams;
const scURL = params.get('src');
const src2 = (new URL(src2)).pathname;
const val = src2.split('/')[2];
console.log(val);
Feel free to consolidate that and eliminate intermediate values as desired.