Hello all, I'd like to typeset an RSS feed and I was wondering whether I could instruct ConTeXt to fetch the contents of a url like: http://feeds.bbci.co.uk/news/rss.xml Thanks for any pointers, Jelle
Hi Jelle, On 2012-04-20 16:15, Jelle Huisman wrote:
Hello all,
I'd like to typeset an RSS feed and I was wondering whether I could instruct ConTeXt to fetch the contents of a url like: http://feeds.bbci.co.uk/news/rss.xml Thanks for any pointers,
the fetching part is easy as we have LuaSocket: ········································································ \starttext \startluacode local bbc_rss = socket.http.request"http://feeds.bbci.co.uk/news/rss.xml" context["type"](bbc_rss) \stopluacode \stoptext \endinput ········································································ In your document, however, you will want to save the file locally for a given Context session and reuse the local copy to avoid re-fetching it on every pass. Maybe use the timestamp to force a fresh fetch after some time. Regards Philipp
Jelle ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
On 04/20/2012 04:40 PM, Philipp Gesang wrote:
Hi Jelle,
On 2012-04-20 16:15, Jelle Huisman wrote:
Hello all,
I'd like to typeset an RSS feed and I was wondering whether I could instruct ConTeXt to fetch the contents of a url like: http://feeds.bbci.co.uk/news/rss.xml Thanks for any pointers,
the fetching part is easy as we have LuaSocket:
Hi Philip, Thank you, that was precisely what I was looking for. I knew that I had seen LuaSocket before, but I could not find it. Jelle
On Fri, 20 Apr 2012, Jelle Huisman wrote:
I'd like to typeset an RSS feed
I was also recently thinking along these lines (set a cron job to typeset RSS feed into pdf and email to kindle). So, please release your code once you are done.
and I was wondering whether I could instruct ConTeXt to fetch the contents of a url like: http://feeds.bbci.co.uk/news/rss.xml
Suppose you write a macro \processrssfile{...} that takes a local rss file and typesets it, then you can simply call \processrssfile{\locfilename{http://feeds.bbci.co.uk/news/rss.xml}} to process a remote file. ConTeXt downloads and caches the file. On subsequent calls, the cached file is used. IIRC, the cache remains valid for a day and it is possible to change the threshold after which a new file is fetched. FWIW, I have added this to t-vim.tex so it can pretty-print remote files. This only works with http:// or ftp:// and not with https:// Aditya
participants (3)
-
Aditya Mahajan
-
Jelle Huisman
-
Philipp Gesang