Ausglamblogs twitter bot now has public feed listing

When I announced @AusGLAMBlogs to the world, a few people asked if they could get the list of blog feeds I was using. At the time, I didn't have an easy and sustainable way to do this. I was also too busy writing a conference paper to devote time to it.

I have now had a bit of time to look at the best way of doing it. What I've done is split the feed listing out into a separate file from the JavaScript file running the bot. I thought this was going to be a bit complicated, but it's actually really simple.

Firstly we need to create a new file to store all our blog feeds. We strip out all the quote marks and commas, and separate each feed with a new line:

https://www.hughrundle.net/rss
http://secondblog.com/feed
http://theoneafterthat.com/rss

Then save it in the same directory as the main file, as feeds.txt.

Back the main js file, we need to require a new package called 'fs'. This is a standard nodejs package that allows you to interact with other files on the server:

var FeedParser = require('feedparser')
, request = require('request'), fs = require('fs');

Then replace the old array with a new line:

var feeds = fs.readFileSync('feeds.txt').toString().split('\n');

This takes the feeds.txt file, brings it into the main JavaScript file as a string, then splits it at each new line.

The end result is the same as what we had before, but now we can simply add a new line to the feeds.txt file whenver we want to add a new feed, and anyone can easily find the list of feeds from that file.

You can find both files at the project page on GitLab. Please let me know if there are any Australian GLAM blogs you like that are not on the list.

Updates to ausGLAMblogs

Building a twitter bot using node, feedparser and simple-twitter (part 1)