Every week we get an alert from the very dedicated OSMBC group, that a new issue is ready on the site. I’m in a country where internet connectivity is expensive, and slow, and unreliable, all at the same time, so I wish to avoid opening the web site with all of its javascript and css files, and only get the information without the site software.
I’ve not been able to make the above situation considered, or understood, but I could use one of the hints I received, namely to check the RSS feed for the newsletter. This feed contains one item per week, and the latest item is the one I want to receive in my mailbox. I first simply added the feed to my Android RSS client, but since every item contains links to pictures, refreshing the feed would again clog my slow limited connection.
What I did was to write a bash one-liner which will run every Sunday on a server hosted in Europe, to which I have access. The script grabs the RSS feed, extracts the first item, and sends it to me by email. Which is what I wanted, so I’m fine now.
Should anybody want to be included in the mail, I have no problem sending them any of the OSMWeekly translations. the only limitation is I can’t send email to google.com.
the script is more or less this:
wget -qO- "https://weeklyosm.eu/feed" | sed -n -e '1,/^\]\]><\/content:encoded>/p' | sed -n -e '/<content:encoded>/,/^\]\]/p' | sed -e 's/.*CDATA.//' -e 's/^\]\]><\/content:encoded>//' | grep -v '^<p class="wp-caption-text"><img loading="lazy" src=".*alt="lead picture"' | grep -v '<p><!-- place picture here --></p>' | mail -a "Content-Type: text/html" -s "OSM Weekly" email@example.com
讨论
gileri 于 2021年08月 5日 07:31 的评论
Nice script and workaround, thanks for sharing !
Some RSS readers have a “low-bandwidth” mode where the images are not loaded, like TinyTinyRss. Maybe that would fit your needs ?
Riccardo Stagni 于 2021年08月 8日 09:55 的评论
Nice workaround indeed, but you may have problems in case of changes of the order of the entries in the feed… And you may risk having duplicate/lost entries if the script doesn’t run “at the right moment”.
Did you consider rss2email? (it’s more like a proper feed reader, with its own db, etc… but hey, no need to deal with xml with sed/grep) :)
mariotomo 于 2021年08月 8日 14:55 的评论
buongiorno Riccardo, grazie per la dritta!
I wasn’t aware of the project rss2email and if I may judge it from the documentation, I do quite like it.
if you followed how this developed on the mailing lists and Telegram groups, you understood that I consider my ‘workaround’ as a symptom of a situation which, I hope, the WeeklyOSM team will acknowledge and address directly.
grazie ancora per rss2email, me lo installo subito! MF
mariotomo 于 2021年08月10日 14:32 的评论
about the RSS readers and low-bandwidth, I am following several news sources, all with which report their news with a single small thumbnail, and I’m happy with receiving them. I do not know why the WeeklyOSM is able to take such a long time for updating. maybe the thumbnails are at full resolution? anyhow: I’d rather not give up thumbnails all over the place only because one feed goes heavy on them, I prefer giving up that single feed, as I also did.
as usual: if it works, don’t fix it. and at the moment my patchy solution works.
qeef 于 2021年08月15日 14:18 的评论
Wouldn’t subscribe via Email from weeklyOSM page just work? (Personally, I haven’t test it yet.)
mariotomo 于 2021年08月15日 15:55 的评论
when subscribing to the WeeklyOSM, I get a link, now with my script I get the content, which is ways more compact than visiting the site at the link.
qeef 于 2021年08月15日 19:52 的评论
Uh, I though that Subscribe to weeklyOSM via Email will send the content of the page. (I just subscribed, so I will see next week.)
I am also subscribed to talk mailing list, where only announcement about new weekly is posted with no content. (I understand that is not a solution for you.)