summaryrefslogtreecommitdiffstats
path: root/knewsticker-scripts/bbc.pl
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /knewsticker-scripts/bbc.pl
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker-scripts/bbc.pl')
-rwxr-xr-xknewsticker-scripts/bbc.pl54
1 files changed, 54 insertions, 0 deletions
diff --git a/knewsticker-scripts/bbc.pl b/knewsticker-scripts/bbc.pl
new file mode 100755
index 0000000..78cb4e3
--- /dev/null
+++ b/knewsticker-scripts/bbc.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+=cut
+
+Copyright (c) 2001 Malte Starostik <malte@kde.org>
+
+Unlimited use, modification and distribution granted as long as the above
+copyright statement and this sentence remain intact.
+
+=cut
+
+use strict;
+use LWP::Simple;
+
+print <<'EOT';
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
+ "http://my.netscape.com/publish/formats/rss-0.91.dtd">
+<rss version="0.91">
+<channel>
+<title>BBC News Headlines</title>
+<description>News from the BBC</description>
+<language>en-gb</language>
+EOT
+
+my ($secnum, $section, $headline, $url);
+foreach (split /\r?\n/, get "http://tickers.bbc.co.uk/tickerdata/story2.dat")
+{
+ $secnum = $1, $section = '' if (/^STORY ([\d+])/ && $1 != $secnum);
+ if (/^HEADLINE (.+)/)
+ {
+ next if $1 =~ /Last update/;
+ $headline = $1;
+ $headline =~ s/&/&amp;/g;
+ $headline =~ s/</&lt;/g;
+ $headline =~ s/>/&gt;/g;
+ $headline =~ s/"/&quot;/g;
+ $section = $headline, $section =~ s/\s*\d+ (Ja|Fe|Ma|Ap|Ju|Au|Se|Oc|No|De)\S+ \d+$// unless $section;
+ }
+ if (/^URL (.+)/)
+ {
+ $url = $1, $url =~ s/&/&amp;/g;
+ print <<EOT
+<item>
+<title>$headline ($section)</title>
+<link>$url</link>
+</item>
+EOT
+ }
+}
+
+print <<'EOT';
+</channel>
+</rss>
+EOT