Last active
November 19, 2016 05:15
-
-
Save eyecatchup/1a315aa8e477b6112d62d128e62c7da9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<script src='//www.google.com/jsapi'></script> | |
<style>p{padding:1px;margin:1px;}section{margin-bottom:15px;}</style> | |
<script> | |
google.load('feeds', '1'); | |
google.setOnLoadCallback(initialize); | |
function createBlocklevelDocElem(text) { | |
var elem = document.createElement("p"); | |
elem.appendChild(document.createTextNode(text.toString())); | |
return elem; | |
} | |
function initialize() { | |
var feed = new google.feeds.Feed('http://www.tvspielfilm.de/tv-programm/rss/jetzt.xml'); | |
feed.setResultFormat(google.feeds.Feed.MIXED_FORMAT); | |
feed.setNumEntries(50); | |
feed.load(function(result) { | |
if (!result.error) { | |
var rootObj = result.feed, | |
rootDoc = result.xmlDocument, | |
docElem = document.getElementById('feed'); | |
if (!!rootObj && !!rootObj.entries.length) { | |
console.log(rootObj.title); | |
console.log(rootObj.description); | |
console.log(rootObj.author); | |
console.log(rootObj.link); | |
console.log(rootObj.feedUrl); | |
// |MIXED_CONTENT| exclusive property. | |
// A pointer to the |XML| {Element} representing that entry in the feed XML document. | |
console.dir(rootObj.xmlNode); | |
for (var i = 0; i < rootObj.entries.length; i++) { | |
var node = rootObj.entries[i]; | |
var section = document.createElement("section"); | |
section.appendChild(createBlocklevelDocElem('Title: ' + node.title)); | |
section.appendChild(createBlocklevelDocElem('URL: ' + node.link)); | |
section.appendChild(createBlocklevelDocElem('Snippet: ' + node.contentSnippet)); | |
section.appendChild(createBlocklevelDocElem('Tags: ' + node.categories.join(', '))); | |
docElem.appendChild(section); | |
} | |
} | |
} | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<div id='feed'></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment