Question

I'm currently trying to parse the html page http://84.19.184.204:8000/played.html using JS.

But it's been hard since I'm new to JS... The html page contains a table which has the history of last played songs... This list is what I want to parse.

I use XMLHttpRequest() but I can't understand how to parse the elements :(

Can someone help me out?

Was it helpful?

Solution

Given the static nature of the layout of Shoutcast played.html pages, a regular expression would probably be the best choice to extract information. However, see my comment to your question as to why doing this in JavaScript might not be a good idea.

OTHER TIPS

Forget that, just get the XML version. Use this URL:

http://84.19.184.204:8000/admin.cgi?pass=YOURADMINPASSWORD&mode=viewxml

You're looking for the <SONGHISTORY> area.

Also, if you do plan on using this on a website, you will need to set up a server-side proxy to access this document. There are a few hundred ways to do this, so if you aren't sure how, create a new question asking this, with details about what server-side language you are using. This is how you get around cross-site scripting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top