yahoo pipes - fetch rss


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function getFeed(feed) {
  5. var newScript = document.createElement('script');
  6. newScript.type = 'text/javascript';
  7. newScript.src = 'http://pipes.yahoo.com/pipes/9oyONQzA2xGOkM4FqGIyXQ/run?&_render=json&_callback=piper&feed='+feed;
  8. document.getElementsByTagName("head")[0].appendChild(newScript);
  9. }
  10. function piper(feed) {
  11. var tmp='';
  12. for (var i=0; i<feed.value.items.length; i++) {
  13. tmp+='<a href="'+feed.value.items[i].link+'">';
  14. tmp+=feed.value.items[i].title+'</a><br>';
  15. if (feed.value.items[i].description) {
  16. tmp+=feed.value.items[i].description;
  17. }
  18. tmp+='<hr>';
  19. }
  20. document.getElementById('rssLayer').innerHTML=tmp;
  21. }
  22. </script>
  23. </head>
  24. <body onLoad='getFeed("http://del.icio.us/rss/popular/javascript")'>
  25. <A HREF="" onclick='getFeed("http://reddit.com/.rss"); return false;'>Reddit</A><BR>
  26. <A HREF="" onclick='getFeed("http://del.icio.us/rss/popular/javascript"); return false;'>Delicious</A><BR>
  27. <A HREF="" onclick='getFeed("http://www.dzone.com/feed/frontpage/rss.xml"); return false;'>DZone</A><BR>
  28. <div id='rssLayer'></div>
  29. </body>
  30. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.