# RSS to POP converter script
#
# This script is for those, who want to read news offline and have not yet found
# an appropriate rss client which would also download (part of) the html page referenced.
#
# It requires additional rss_xxx.properties files with the definitions of rss feeds
# In these files you have to specify the feed and its url, e.g. here the feed yyy:
# [yyy]
# url=http://rss.cnn.com/rss/cnn_topstories.rss
# Additionally you should specify the pattern to get the text of the news
# (without navigation, ...), e.g.:
# text=(
.*?
.*?
)
# Otherwise the whole page is downloaded.
# To remove ads or other stuff from the test, use a delete pattern, e.g.:
# delete=]*>
# Text and delete pattern can also be specified before the first feed. They will
# be used unless a feed specifies an own pattern.
#
# To use rss feeds in your mail client, use the username
# xxx-yyy@rss
# where xxx is the property file name (without rss_ and .properties) and [yyy] is the feed.
# If no feed is specified, e.g.
# xxx@rss
# then all feeds are retrieved.
# You can have multiple feeds downloaded by separating them with a dot:
# xxx1-yyy1.xxx2-yyy2.xxx3@rss
#
# @Requires: 1.1
# @Version: 0.7.1
# german texts (with MrPostman 1.2.2+)
# @Version: 0.7
# possibility to add styles and download multipage news
# @Version: 0.6
# enhanced help for MrPostman 1.2+
# @Version: 0.5
# use internal html2text instead of script function
# @Version: 0.4
# update functionality (only with 1.1 and later)
# @Version: 0.3
# plain text download
# @Version: 0.2
sub getInfo
local(info)
info.name = "RSS feeds"
info.authors[0] = "Martin Vlcek "
info.version = "0.7.1"
info.updateService = ""
info.documentationlink = ""
info.options["descrDir"].order = 1
info.options["descrDir"].value = "rss"
info.options["descrDir"].label = "Feed Descr. Directory"
info.options["descrDir"].description = "Directory with the feed descriptions"
info.options["updateUrl"].order = 2
info.options["updateUrl"].value = "http://mrpostman.sourceforge.net/scripts.html"
info.options["updateUrl"].label = "Update URL(s)"
info.options["updateUrl"].description = "Where to get updated feed descriptions from"
info.options["downloadImages"].order = 3
info.options["downloadImages"].value = true
info.options["downloadImages"].label = "Download images"
info.options["downloadImages"].description = "Download images as attachments and adjust image links accordingly"
info.options["plain"].order = 4
info.options["plain"].value = false
info.options["plain"].label = "Plain text"
info.options["plain"].description = "Download as plain text, no images"
#--- german texts
info.options["descrDir"].label = "RSS-Beschr.-Ordner"
info.options["descrDir"].description = "Verzeichnis mit den RSS-Feed-Beschreibungen"
info.options["updateUrl"].label = "Aktualisierungs-URL(s)"
info.options["updateUrl"].description = "URL(s) von Webseiten mit aktuellen RSS-Feed-Beschreibungen"
info.options["downloadImages"].label = "Bilder herunterladen"
info.options["downloadImages"].description = "Bilder als Anhänge herunterladen und Bilder-Links entsprechend anpassen"
info.options["plain"].label = "Nur Text"
info.options["plain"].description = "Nur reinen Text ohne Formatierungen und Bilder herunterladen"
return info
end
sub getDocumentationText
local(d,dir,filename,found,feed,numfound,subfeeds,subfeed)
dir = info.options["descrDir"].value
d = "
RSS News Feed Module
\n"
d = d & "
This module provides RSS news feed support for MrPostman.
\n"
d = d & "
Detailed information on how to set up your e-mail client for RSS feeds, may be found here.
\n"
d = d & "
Currently the following feed files are available (in parentheses the user name you would use in your e-mail client, multiple feeds can be separated by a dot, e.g. cnn_com-topstories.bbc_co_uk-world@rss):
\n
"
foreach(getdirectory(dir,"rss_.*\.properties"),filename)
found,feed = match(filename,"^rss_(.*)\.properties$")
d = d & "
" & filename & " (for all sub feeds: " & feed & "@rss)\n
\n"
rawfile = readfile(dir & "/" & filename)
numfound,subfeeds = matchall(rawfile,"^\[([^\]]*)\]")
foreach(subfeeds,subfeed)
d = d & "