Skip to content

Instantly share code, notes, and snippets.

@landsurveyorsunited
Created August 2, 2023 19:43
Show Gist options
  • Save landsurveyorsunited/d05eee6226b6ba6c3352463dad367c2d to your computer and use it in GitHub Desktop.
Save landsurveyorsunited/d05eee6226b6ba6c3352463dad367c2d to your computer and use it in GitHub Desktop.
Feed agregator
<html>
<head>
<meta charset="utf-8" />
<title>Charleston White Feeds</title>
<script type="text/javascript" src="https://rss2json.com/gfapi.js"></script>
<script type="text/javascript">google.load("feeds", "1")</script>
</head>
<body>
<div id="feed"></div>
</body>
</html>
var feedcontainer=document.getElementById("feed");
var feedurl="https://news.google.com/rss/search?q=Charleston%20White&hl=en-US&gl=US&ceid=US%3Aen";
var feedlimit=20;
var rssoutput="<ul>";
function rssfeedsetup(){
var feedpointer = new google.feeds.Feed(feedurl);
feedpointer.setNumEntries(feedlimit);
feedpointer.load(displayfeed);
}
function displayfeed(result){
if (!result.error){
var thefeeds=result.feed.entries;
for (var i=0; i<thefeeds.length; i++)
{
rssoutput+="<li><a href='" + thefeeds[i].link + "'target='_blank'>" + thefeeds[i].title + "</a></li>"
}
}
else {
alert("Error fetching feeds!");
}
rssoutput+="</ul>";
feedcontainer.innerHTML=rssoutput;
}
window.onload=function(){
rssfeedsetup();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
@charset "utf-8";
/* CSS Document */
body {
background-color:#E3FDF8;
}
h1 {
font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
font-size: 1.5em;
color:#5C5C5C;
}
h2 {
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:1.2em;
color:#606060;
margin: 25px;
}
a {
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 1em;
text-decoration:none;
color:#323232;
}
a:hover {
text-decoration:underline;
color:#352DCE;
background-color:#efecec;
}
ul {
list-style:circle;
margin-left:-15px;
}
div {
width:auto;
height:400px;
background-color: #F1F1F1;
padding: 8px 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment