This software utilizes the MBTA API to grab alerts and stop lists for public transit routes in Greater Boston.
pip install requests)
Run the following as root:
mbta2rss >out.xml. Then you can open the XML file in your
favorite RSS feed reader.
-d datatype: choose type of data to grab (alerts or stops, default is alerts)
-k key: Use an API key.
-o fmt: Set output format (rss or md, default is rss).
-r routes: Set route(s) to look for (comma separated)
-t time: Set time filter to show alerts active at that time (default shows all times, "NOW" for alerts in effect now, must be in ISO 8601 time format).
-T title: document/feed title
-D description: document/feed description
-U url: upstream URL for RSS feed
Add the following to your crontab:
0 * * * * /usr/bin/mbta2rss -k "$MYAPIKEY" >$HOSTDIR/rss.xml
An example of emailing a Markdown-formatted digest using the
mbta2rss -o md -k "$MYAPIKEY" -r "Orange,36" -t "NOW" | headmail "$FROM" "$TO" | sendmail -a \ "$ACCOUNT" -t "$TO"
If you wanted to convert it to HTML first, a Markdown to HTML filter must be used (like smu:
mbta2rss -o md -k "$MYAPIKEY" -r "Orange,36" -t "NOW" | smu | headmail "$FROM" "$TO" \ | msmtp -a "$MSMTPACCOUNT" -t "$TO"
It is possible to make a HTML webpage (no CSS included by default) for the web using the Markdown output format and piping it into a Markdown to HTML filter.
mbta2rss -o md -k "$MYAPIKEY" | smu >out.html
No known bugs. If one is found, submit an issue, PR, or email me with a description and/or patch.
Please feel free to contribute. Send patches via email or submit a pull request.
Copyright (C) 2019-2021 Ben O'Neill email@example.com. License: GNU GPL Version 3 https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.