-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
- Get list members
async function getMembers () {
const DATA_SOURCE = 'https://raw.githubusercontent.com/evilfactorylabs/mbote/master/src/member.json'
const req = await fetch(DATA_SOURCE)
const json = await req.json()
return json.rss
}- Get list posts
async function getPosts () {
const DATA_SOURCE = 'https://raw.githubusercontent.com/evilfactorylabs/mbote/master/src/cached.json'
const req = await fetch(DATA_SOURCE)
const json = await req.json()
return json
}- Group it based on
normalizedURL
async function groupPosts () {
const posts = await getPosts()
const members = await getMembers()
const createKeyFromMembers = members.map(member => {
const url = member.rss
const normalizedUrl = new URL(url).hostname
return { url: normalizedUrl }
})
const groupPostByMember = createKeyFromMembers.map(member => {
const grouped = []
posts.map(post => {
if (post.link.includes(member.url)) {
grouped.push({ ...post })
}
})
return grouped
})
return groupPostByMember
}- TODO:
// 0. This code is not tested, just my imagination!
// 1. I believe there is an easy way rather than this
// 2. Group it based on normalizedURLReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels