-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated blog feed and metadata build scripts to
use ES6 modules and Github Actions.
- Loading branch information
1 parent
0b274af
commit 57331a1
Showing
9 changed files
with
236 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from 'fs'; | ||
import { extract } from '@extractus/feed-extractor' | ||
|
||
// Read JSON file | ||
const sitedata = JSON.parse(fs.readFileSync('src/customizations/siteproperties.json', 'utf8')); | ||
const feedUrl = sitedata.substackUrl + '/feed'; | ||
|
||
// Fetch the RSS feed | ||
async function fetchRssFeed() { | ||
try { | ||
// Fetch the RSS feed | ||
const feedData = await extract(feedUrl, { | ||
useISODateFormat: false, | ||
getExtraEntryFields: (feedEntry) => { | ||
return { 'content:encoded': feedEntry['content:encoded'] || '' }; | ||
} | ||
}); | ||
|
||
// Verify that the fetched data is a valid Javascript object | ||
if (!feedData || typeof feedData !== 'object') { | ||
throw new Error('Invalid RSS feed data'); | ||
} | ||
|
||
// Convert the Javascript object to JSON and save as a UI component | ||
fs.writeFileSync('src/components/ui/RssFeed.json', JSON.stringify(feedData, null, 2)); | ||
|
||
console.log('RSS feed saved successfully!'); | ||
} catch (error) { | ||
console.error('Error fetching RSS feed:', error); | ||
} | ||
} | ||
|
||
fetchRssFeed(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.