youtube - How do I display this XML document? -
effectively i'm trying display data (actually combined data multiple channels it's same idea):
https://www.youtube.com/feeds/videos.xml?user=youtube
i used found on w3schools:
<script> if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.open("get","https://www.youtube.com/feeds/videos.xml?user=youtube",false); xmlhttp.send(); xmldoc=xmlhttp.responsexml; var x=xmldoc.getelementsbytagname("item"); (i=0;i<x.length;i++) { document.write("<tr><td>"); document.write(x[i].getelementsbytagname("pubdate") [0].childnodes[0].nodevalue); document.write("</td><td>"); document.write(x[i].getelementsbytagname("author") [0].childnodes[0].nodevalue); document.write("</td><td>"); document.write(x[i].getelementsbytagname("views")[0].childnodes[0].nodevalue); document.write("</td><td>"); document.write(x[i].getelementsbytagname("author") [0].childnodes[0].nodevalue); document.write("</td><td>"); document.write(x[i].getelementsbytagname("media:description") [0].childnodes[0].nodevalue); document.write("</td><td>"); document.write(x[i].getelementsbytagname("link")[0].childnodes[0].nodevalue); document.write("</td></tr>"); } document.write("</table>"); </script> i need display other data "media:description" can't figure out how, or worse:
<media:community> <media:starrating count="45552" average="4.67" min="1" max="5"/> <media:statistics views="4641380"/> how can display this?
i tried:
document.write(x[i].getelementsbytagname("media:group.media:community.media:statistics")[0].childnodes[0].nodevalue);
Comments
Post a Comment