Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/ap-update/ap

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
#
#	get AP news headline list or the given story
#

wire='http://www.newsday.com/news/nationworld/wire'
if ( ~ $#* 0 )
	hget $wire | #tee /tmp/ap.$pid |
		sed -n '/AP Top News/,/AP News Wire/p' |
		htmlfmt -a -w 100 |
		sed -n '
			/^• / {
				N
				s/^• / /g
				s/\n/ /g
				s/\[\/news\/nationworld\/wire\//|/
				s/sns-ap-//
				s/,[0-9]+,[0-9]+\.story.*$//
				p
		}' |
		awk -F '|' '
			{
			s = "";
			for (i = 1; i < NF; i++)
				s = s " " $i;
			printf("ap %-40s # %s\n", $NF, s);
		}'

if not
	hget $wire/sns-ap-^$1^.story |
		htmlfmt |
		sed '
			1,/^=======$/d
			/^Email this story$/d
			/^Printer friendly format/d
			/^\* __$/,$d
			/^Subscribe to Newsday home delivery/,$d
			/^SPONSORED LINKS$/,$d
		' 

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.