guichaguri / post-feed-reader Goto Github PK
View Code? Open in Web Editor NEWDiscovers and parses news, blog and podcast posts from any website
Home Page: https://www.npmjs.com/package/post-feed-reader
License: Apache License 2.0
Discovers and parses news, blog and podcast posts from any website
Home Page: https://www.npmjs.com/package/post-feed-reader
License: Apache License 2.0
I found some inconsistencies, while parsing a RSS feed the content
property of a post will contains its <description>
instead of the actual content.
source
Here is my proposal:
interface PostItem {
...
/**
* The item content
*
* `content` from Atom 1.0 and WP API
* `content` from RSS 0.91, RSS 1.0 and RSS 2.0
* `content_html` and `content_text` from JSON Feed 1.1
*/
content?: PostContent;
/**
* The item summary or excerpt
*
* `summary` from Atom 1.0 and JSON Feed 1.1
* `description` from RSS 0.91, RSS 1.0 and RSS 2.0
* `excerpt` from WP API
*/
summary?: PostContent;
...
}
Implement a parser for h-feed, part of the microformats2 spec.
The format could be automatically discovered by looking for a h-feed
or hfeed
class in the HTML body.
Although this should be relatively easy to support, it is an old format that doesn't look like it is being widely used. Statistics on usage from both sites and readers, and how it compares to other already supported formats (such as RSS) should be taken in consideration before implementing it.
It seems that pagination is supported by all formats:
next_url
)It's definitely possible to fetch "the next page" where available. The only thing to think is how the API should be designed, here is my proposal:
// Add a property to the PostList object, which tells information about the pagination
interface PostList {
...
pagination: PostListPagination;
...
}
interface PostListPagination {
currentPage?: number; // Supported only by WP API
totalPages?: number; // Supported only by WP API
totalPosts?: number; // Supported only by WP API
next?: DiscoveredSource; // Supported by all formats
previous?: DiscoveredSource; // Supported by Atom/RSS and WP API
first?: DiscoveredSource; // Supported by all formats
last?: DiscoveredSource; // Supported by Atom/RSS and WP API
}
// Fetching the next one is as simple as fetching the first
const nextList = await getPostList(list.pagination.next);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.