kyblog
v1.0.0
Published
Universal JS SDK for Blogger (CommonJS, ESM, TypeScript, Browser)
Maintainers
Readme
kyBLOG
Universal JS SDK for Blogger Supports CommonJS, ESM, TypeScript, and Browser (UMD). Fetch posts, labels, images, and excerpts from any Blogger blog.
node output
Installation
npm install kyblogusage example
Importing (TypeScript / Node ESM)
import { kyBLOG } from './dist/kyblog.esm.js'
const blog = new kyBLOG("https://tv48click.blogspot.com")
Basic Usage
Fetch the first 5 posts:
const posts = await blog.posts({ limit: 5 })
console.log(posts.posts)Output structure:
[
{
id: string,
title: string,
url: string,
published: string,
updated: string,
excerpt: string,
content: string,
images: string[],
labels: string[]
}
]
Fetch Posts by Label
const techPosts = await blog.posts({ limit: 5, label: "Technology" })
console.log(techPosts.posts)This filters posts that have the Technology label.
Pagination for Large Blogs (1000+ Posts)
let allPosts: any[] = []
let start = 1
const batchSize = 50
let batch
do {
batch = await blog.posts({ start, limit: batchSize })
allPosts = allPosts.concat(batch.posts)
start += batchSize
} while (batch.posts.length === batchSize)
console.log("Total posts fetched:", allPosts.length)
Access Post Images, Excerpts, and Labels
const firstPost = allPosts[0]
console.log("Title:", firstPost.title)
console.log("Excerpt:", firstPost.excerpt)
console.log("Images:", firstPost.images) // Array of image URLs
console.log("Labels:", firstPost.labels) // Array of labels
Fetch All Posts for Multiple Labels
const labels = ["Technology", "Science", "AI"]
for (const label of labels) {
const posts = await blog.posts({ limit: 10, label })
console.log(`Posts for ${label}:`, posts.posts)
}
TypeScript Support
Types are included in dist/types/index.d.ts:
import { kyBLOG } from './dist/kyblog.esm.js'
const blog: kyBLOG = new kyBLOG("https://tv48click.blogspot.com")
const posts = await blog.posts({ limit: 5 })
posts.posts.forEach(post => {
console.log(post.title, post.labels, post.images)
})Browser Example (UMD)
<script src="./dist/kyblog.umd.js"></script>
<script>
const blog = new kyBLOG("https://tv48click.blogspot.com")
blog.posts({ limit: 5, label: "Technology" }).then(data => {
data.posts.forEach(post => {
console.log(post.title)
console.log("Excerpt:", post.excerpt)
console.log("Images:", post.images)
console.log("Labels:", post.labels)
})
})
</script>blogger dashboard
Notes
Works with any Blogger URL.
Handles up to 1000+ posts with pagination.
Extracts images, labels, excerpts, and full content.
Ready for Node.js, TypeScript, and browser environments.
UMD build is minified with @rollup/plugin-terser.
