My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# ----------------------------------------------------------------------------
# http://... - vários
# Busca as últimas notícias sobre Linux em sites nacionais.
# Obs.: Cada site tem uma letra identificadora que pode ser passada como
# parâmetro, para informar quais sites você quer pesquisar:
#
# Y)ahoo Linux B)r Linux
# V)iva o Linux U)nder linux
# N)otícias linux
#
# Uso: zznoticiaslinux [sites]
# Ex.: zznoticiaslinux
# zznoticiaslinux yn
#
# Autor: Aurelio Marinho Jargas, www.aurelio.net
# Desde: 2001-12-17
# Licença: GPL
# ----------------------------------------------------------------------------
zznoticiaslinux ()
{
zzzz -h noticiaslinux "$1" && return

local url limite
local n=5
local sites='byvucin'

limite="sed ${n}q"

[ "$1" ] && sites="$1"

# Yahoo
if zztool grep_var y "$sites"
then
url='http://br.noticias.yahoo.com/rss/linux'
echo
zztool eco "* Yahoo Linux ($url):"
$ZZWWWHTML "$url" |
tr '<' '\n' |
sed -n '/^item>/,$ s@^title>@@p' |
zztool texto_em_utf8 |
$limite
fi

# Viva o Linux
if zztool grep_var v "$sites"
then
url='http://www.vivaolinux.com.br'
echo
zztool eco "* Viva o Linux ($url):"

# TODO Em alguns sistemas as notícias vêm gzipadas, tendo que
# abrir com gzip -d. Reportado por Rodrigo Azevedo.

$ZZWWWHTML "$url/index.rdf" |
sed -n '1,/<item>/d;s@.*<title>\(.*\)</title>@\1@p' |
zztool texto_em_utf8 |
$limite
fi

# Br Linux
if zztool grep_var b "$sites"
then
url='http://br-linux.org/feed/'
echo
zztool eco "* BR-Linux ($url):"
$ZZWWWHTML "$url" |
sed -n '1,/<item>/d ; s/.*<title>// ; s@</title>@@p' |
sed 's/&#822[01];/"/g ; s/&#8211;/-/g' |
zztool texto_em_utf8 |
$limite
fi

# UnderLinux
if zztool grep_var u "$sites"
then
url='http://feeds.feedburner.com/underlinux'
echo
zztool eco "* UnderLinux ($url):"
$ZZWWWHTML "$url" |
sed -n '1,/<item>/d ; s/.*<title>// ; s@</title>@@p' |
zztool texto_em_utf8 |
$limite
fi

# Notícias Linux
if zztool grep_var n "$sites"
then
url='http://www.noticiaslinux.com.br'
echo
zztool eco "* Notícias Linux ($url):"
$ZZWWWHTML "$url" |
sed -n '/<[hH]3>/{s/<[^>]*>//g;s/^[[:blank:]]*//g;p;}' |
zztool texto_em_iso |
$limite
fi
}

Change log

r710 by aureliojargas on Mar 29, 2012   Diff
SEGURANÇA: $1 colocado entre aspas na
chamada padrão zzzz -h de todas as
funções.
Go to: 
Sign in to write a code review

Older revisions

r669 by aureliojargas on Mar 28, 2012   Diff
lint: removendo espaços inúteis. Parte
2.
r655 by aureliojargas on Mar 23, 2012   Diff
s/Aurélio/Aurelio/ *
r409 by aureliojargas on May 2, 2011   Diff
zznoticiaslinux: Yahoo: URL e filtro
atualizados (valeu Tiago Madeira)
All revisions of this file

File info

Size: 2291 bytes, 96 lines
Powered by Google Project Hosting