Amnesty International - Newsfeed

Description

This provides a newsfeed from the Amnesty International Online Library in formats that can be easily included on any web site as Javascript, Text, HTML, RSS or XML. You can define the category (country, region, theme) you want and the number of items to be displayed and these provide links to the original amnesty.org document. The benefit of using this is that the listing can be filtered to suit the local site needs (e.g. using the Spanish version and only need display the countries of interest) and formatted to integrate with the site style.

The feed is (almost) 'live' so any web site using this will always have the latest reports without any manual updating. There is actually a 60 minute delay caused by 'caching' (saving and re-using a recent copy) but in the context of AIDOC, this delay is not significant and it reduces the load on both web.amnesty.org and our server.

If our site fails you should just get a blank result (with Javascript); if AIDOC fails there may be up to a 30 second delay (it will try for that long) and then it will show 'AIDOC - Site Error' or 'No Documents' to indicate there is a problem. These error message will persist for 60 minutes but this avoids repeated 30 second delays every time someone tries to access your site. The messages link to the AIDOC site so people can have a direct look to see if it working.

Example users

Commands

http://catalyse.net/amnesty/newsfeed.php?cat=category
&n=number&f=format&w=width&h=height&p

The parameters are:

Formats

Javascript avoids server-side scripting, but to display the table the above URL must be enclosed within script tags. The returned table is in the form:

<table summary="Newsfeed" class="Newsfeed">
  <tr>
    <td valign="top">Date</td>
    <td><a href="http://web.amnesty.org/library/IndexPrint/DocID?OpenDocument" target="_blank">Title</a></td>
  </tr>
</table>

You can use the class name to set a specific style using CSS. e.g. (this is in use on this page to display in a small sans-serif font):

<style type="text/css">
<!--
.Newsfeed {font: 8pt Verdana,Arial,Helvetica,sans-serif;}
-->
</style>

HTML snippets may be useful as it is more flexible (HTML code as above). This can be used if you have server side access or use IFRAME or OBJECT tags to include it.

Tabbed Text may be useful for Java as they can often be used with plain text file This is simply Date+Title+URL with each entry on a separate line.

RSS (Really Simple Syndication) is for news aggregators. It uses version 2.0 are defined by http://blogs.law.harvard.edu/tech/rss

XML is for data exchange using a simple standalone definition (no DTD).

PHP Source Code

Examples

Javascript (Recent)

<script src="http://catalyse.net/amnesty/newsfeed.php?cat=eng-recent&n=5"
  language="javascript" type="text/javascript">
</script>

Javascript Merged (Recent)

<script src="http://catalyse.net/amnesty/newsfeed.php?cat=eng-recent&f=jm&n=5"
  language="javascript" type="text/javascript">
</script>

Marquee (Indonesia)

NB: not officially approved under W3C HTML and only works in IE and Mozilla (buggy in 1.3b - the height and scroll don't work - but will be fixed in next release). As such, if you are tempted to use it for a long vertical list, don't: Netscape viewers will get the whole list in one page... use a small list or a Java Applet instead.

The extra "onclick" javascript is so it can be stopped and started by clicking anywhere or the scrolling area - otherwise it can be irritating and hard to read or select any links.

Scripted

<marquee height="50" scrollamount="1" scrolldelay="0" direction="up" width="350"
  onclick="javascript:this.scrollDelay^=1000;">
  <script src="http://catalyse.net/amnesty/newsfeed.php?cat=eng-idn&n=10"
    language="javascript" type="text/javascript">
  </script>
</marquee>

Auto

<script src="http://catalyse.net/amnesty/newsfeed.php?cat=eng-idn&n=10&w=500"
  language="javascript" type="text/javascript">
</script>

Tabbed Text (Death Penalty)

http://catalyse.net/amnesty/newsfeed.php?cat=eng-392&n=10&f=t

Example - RSS (South America in Spanish)

http://catalyse.net/amnesty/newsfeed.php?cat=esl-2m3&n=10&f=r

Example - XML (South America in Spanish)

http://catalyse.net/amnesty/newsfeed.php?cat=esl-2m3&n=10&f=x

Comments

Please contact me if you have any questions or suggestions - neil.munro A T catalyse.net

Neil Munro

History

08/12/2003 Fixed parsing error when title contains the word "open" which was confused with domino command "?open"; changed cache time for reports to 24 hours as they do not come out very often so it is pointless refreshing every hour; examples updated and CSS style facility demonstrated.

19/06/2004 amnesty.org does not appear to accept HTTP 1.0 requests so changed to HTTP 1.1 and this solved it.

28/07/2004 Fixed HTML interpretation of titles e.g. "&" now returns "&amp;".