An easy-to-use interface for making requests to the Blogger Feeds API.
Download the feeddy script and include it in your project.
<script src="./path-to/feeddy.js"></script>
or you can use
<script src="https://yoimerdr.github.io/feeddy/dist/feeddy.min.js"></script>
feeddy.posts({
feed: {
// For tests only you can use the 'https://cors-anywhere.herokuapp.com/' + your blog url.
// Allow temporary access on https://cors-anywhere.herokuapp.com/corsdemo
blogUrl: '', // The blog url, or nothing if the current origin is the blogger blog.
params: feeddy.search.params()
.limit(12)
.build()
},
onTotal(handler) {
handler.page(1); // retrieve the first 12 posts
},
onPosts(posts, blog) {
console.log(posts);
}
})
feeddy.posts({
feed: {
blogUrl: '', // The blog url, or nothing if the current origin is the blogger blog.
params: feeddy.search.params()
.limit(12)
.query(
feeddy.search.query()
.terms('term') // The term for search, for terms with spaces use .exact() before .terms()
.build()
)
.build()
},
onTotal(handler) {
handler.page(1); // retrieves the first 12 posts
},
onPosts(posts, blog) {
console.log(posts);
}
})
feeddy.posts.withCategories({
feed: {
blogUrl: '', // The blog url, or nothing if the current origin is the blogger blog.
params: feeddy.search.params()
.limit(12)
.build()
},
categories: ['category', 'name'],
onPosts(postsAndCounts, blog) {
console.log(postsAndCounts); // will print the first 12 posts with the categories `category` or `name`
}
})
feeddy.feed({
blogUrl: '', // The blog url, or nothing if the current origin is the blogger blog.
params: feeddy.search.params()
.limit(12)
.build()
}).then(console.log)
feeddy.feed.raw({
blogUrl: '', // The blog url, or nothing if the current origin is the blogger blog.
params: feeddy.search.params()
.limit(12)
.build()
}).then(console.log)
You can read about the methods available and how responses are structured here.
This project is licensed under the MIT License - see the LICENSE file for details.
git clone https://github.com/yoimerdr/feeddy.git
Creates the lib
folder
mkdir lib
Moves into
cd lib
Clones the jstls
dependency
git clone https://github.com/yoimerdr/jstls.git
And edit the project as you wish.