Skip to content

Commit

Permalink
add rss feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumewuip committed Jul 21, 2023
1 parent 3d0fbb9 commit 9c3c03c
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 34 deletions.
76 changes: 73 additions & 3 deletions rss-to-tana/index.js
Expand Up @@ -7,18 +7,88 @@ const Tana = require('./tana');

const parser = new RSSParser();

const schedules = {
twiceAtNight: '0 0 23,6 * * *', // 23:00 and 06:00 every day
everyHour: '0 0 * * * *', // every hour every day
}

const rssFeeds = [
// Music
{
url: 'https://lesoreillescurieuses.com/feed/',
cron: '0 0 23,6 * * *', // 23:00 and 06:00 every day
cron: schedules.twiceAtNight,
toTana: Tana.album,
},
{
url: 'https://cmd.wuips.com/rss/feed.xml',
cron: '0 0 * * * *', // every hour every day
cron: schedules.everyHour,
toTana: Tana.music,
},
{
url: 'http://pitchfork.com/rss/reviews/best/albums/',
cron: schedules.twiceAtNight,
toTana: Tana.album,
},
{
url: 'https://www.prun.net/emission/8MNV-iss/rss',
cron: schedules.twiceAtNight,
toTana: Tana.music,
},
{
url: 'https://stnt.org/rss.xml',
cron: schedules.twiceAtNight,
toTana: Tana.album,
},
{
url: 'https://www.tsugi.fr/feed/',
cron: schedules.twiceAtNight,
toTana: Tana.album,
},

// Tech
{
// Codrops
url: 'http://feeds2.feedburner.com/tympanus',
cron: schedules.everyHour,
toTana: Tana.website,
},
{
url: 'https://leaddev.com/content-piece-and-series/rss.xml',
cron: schedules.everyHour,
toTana: Tana.website,
},
{
// Thoughtworks Technology Podcast
url: 'http://feeds.soundcloud.com/users/soundcloud:users:94605026/sounds.rss',
cron: schedules.everyHour,
toTana: Tana.website,
},

// Design
{
url: 'http://minimalissimo.com/feed/',
cron: schedules.twiceAtNight,
toTana: Tana.website,
},

// Personal Development
{
url: 'http://feeds.feedburner.com/zenhabits',
cron: schedules.twiceAtNight,
toTana: Tana.website,
},

// Others
{
url: 'http://www.lesothers.com/feed/',
cron: schedules.twiceAtNight,
toTana: Tana.website,
},
{
url: 'https://worksinprogress.substack.com/feed/',
cron: schedules.twiceAtNight,
toTana: Tana.website,
}
];

function parseFeed(feed) {
Expand All @@ -32,7 +102,7 @@ function parseFeed(feed) {
if (pubDate > lastRunDate) {
console.log(feed.url, `new ${item.title} detected`);

const tanaNode = feed.toTana(item)
const tanaNode = feed.toTana(feed.url, item)
saveItem(tanaNode);
}
}
Expand Down
94 changes: 63 additions & 31 deletions rss-to-tana/tana.js
@@ -1,4 +1,44 @@
function album(item) {
function source(feedUrl) {
return {
/* Source */
type: "field",
attributeId: "SalqarOgiv",
children: [
{
name: `RSS to Tana - ${feedUrl}`
}
]
}
}

function title(item) {
return {
/* Title */
type: 'field',
attributeId: 'ksBOEhsvfu',
children: [
{
name: item.title,
}
]
}
}

function url(item) {
return {
/* URL */
type: 'field',
attributeId: 'S4UUISQkxn2X',
children: [
{
dataType: 'url',
name: item.link
}
]
}
}

function album(feedUrl, item) {
return {
name: item.title,
supertags: [
Expand All @@ -8,31 +48,31 @@ function album(item) {
},
],
children: [
title(item),
url(item),
source(feedUrl)
]
}
}

function music(feedUrl, item) {
return {
name: item.title,
supertags: [
{
/* Title */
type: 'field',
attributeId: 'ksBOEhsvfu',
children: [
{
name: item.title,
}
]
/* Music */
id: 'VI7FwJEpFAqY'
},
{
/* Source */
type: 'field',
attributeId: 'SalqarOgiv',
children: [
{
name: item.link
}
]
}
],
children: [
title(item),
url(item),
source(feedUrl)
]
}
}

function website(item) {
function website(feedUrl, item) {
return {
name: item.title,
supertags: [
Expand All @@ -42,22 +82,14 @@ function website(item) {
}
],
children: [
{
/* URL */
type: 'field',
attributeId: 'S4UUISQkxn2X',
children: [
{
dataType: 'url',
name: item.link
}
]
},
url(item),
source(feedUrl)
]
}
}

module.exports = {
album,
music,
website,
}

0 comments on commit 9c3c03c

Please sign in to comment.