; [nI] FOXNews Headlines v2.1
;
; Usage: /getnews
; Installation: /load -rs ni-FOXNews.mrc
;
on *:LOAD:{
echo $color(info) -s [nI] FOXNews Headlines v2.1 Loaded...
echo $color(info) -s * Usage: /getnews
echo $color(info) -s -
}
alias getnews {
if $sock(FOX) != $null { sockclose FOX }
sockopen FOX
www.FOXNews.com 80
.unset %FOX.line
.unset %FOX.temp
.set %FOXNews.output $+(",$scriptdir,FOX-news.txt,")
.set %FOXNews.output2 $+(",$scriptdir,FOX-urls.txt,")
write -c %FOXNews.output
write -c %FOXNews.output2
if $dialog(FOX) != $null { dialog -v FOX }
else { dialog -mv FOX FOX }
did -r FOX 5
did -ra FOX 27
http://www.FOXNews.com}
alias saveheadlines {
set %fox.savefile $sfile($scriptdir $+ *.txt,Save Headlines As...,Save)
if %fox.savefile == $null {
halt
}
else {
write -c %fox.savefile
write %fox.savefile [nI] FOXNews Headlines -- ZeroSyrge
write %fox.savefile $str(-,35)
write %fox.savefile Date: $chr(9) %fox.updatetime
write %fox.savefile $str($crlf,2)
write %fox.savefile [url= $str($chr(9),7) [HEADLINE]
.unset %fox.save1
.set %fox.save2 $lines(%FOXNews.output)
:next
inc %fox.save1
if %fox.save1 <= %fox.save2 {
write %fox.savefile $read(%FOXNews.output2,%fox.save1) $chr(9) $read(%FOXNews.output,%fox.save1)
goto next
}
else {
echo $color(info) -se * Saved Headlines To: %fox.savefile
run notepad %fox.savefile
}
}
}
on *:sockopen:FOX:{
sockwrite -n $sockname GET /index.html HTTP/1.0
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Accept-Language: en-us
sockwrite -n $sockname Accept-Encoding: gzip, deflate
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
sockwrite -n $sockname Host: [url=http://www.FOXNews.com]www.FOXNews.com] $str($chr(9),7) [HEADLINE]
.unset %fox.save1
.set %fox.save2 $lines(%FOXNews.output)
:next
inc %fox.save1
if %fox.save1 <= %fox.save2 {
write %fox.savefile $read(%FOXNews.output2,%fox.save1) $chr(9) $read(%FOXNews.output,%fox.save1)
goto next
}
else {
echo $color(info) -se * Saved Headlines To: %fox.savefile
run notepad %fox.savefile
}
}
}
on *:sockopen:FOX:{
sockwrite -n $sockname GET /index.html HTTP/1.0
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Accept-Language: en-us
sockwrite -n $sockname Accept-Encoding: gzip, deflate
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
sockwrite -n $sockname Host: [url=http://www.FOXNews.com]
www.FOXNews.com[/url]
; sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname
did -a FOX 5 Connecting, please wait...
}
on *:sockread:FOX:{
.unset %FOX.x*
set %FOX.a <a href="/story/0,
if ($sockerr > 0) return
:next
.inc %FOX.line
sockread %FOX.temp
if ($sockbr == 0) return
if (%FOX.temp == $null) %FOX.temp = -
if %FOX.a isin %FOX.temp {
if ($striphtml(%FOX.temp) == $null) || ($gettok($gettok($replace(%FOX.temp,<a,$chr(173)),2,173),2,34) == $null) { goto next }
write %FOXNews.output2
http://www.FOXNews.com $+ $gettok($gettok($replace(%FOX.temp,<a,$chr(173)),2,173),2,34)
if • isin $gettok($striphtml(%FOX.temp),1,32) { set %FOX.temp $gettok($striphtml(%FOX.temp),2-,32) }
if • isin $striphtml(%FOX.temp) { set %FOX.temp $replace($striphtml(%FOX.temp),•,--[FOX]--) }
write %FOXNews.output $striphtml(%FOX.temp)
}
goto next
}
on *:sockclose:FOX:{
did -r FOX 5
did -a FOX 7 Double-Clicking a Headline Will Open It In Your Browser... (Updated: $asctime(mmmm doo $+ $chr(44) yyyy -- hh:nntt) $+ )
set %fox.updatetime $asctime(mmmm doo $+ $chr(44) yyyy -- hh:nntt)
FOXdialog
}
; $striphtml by fubar
alias striphtml {
if ($1) {
var %strip,%parm = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
while ($gettok($gettok(%parm,%n,62),1,60)) {
%strip = %strip $ifmatch
inc %n
}
return %strip
}
}
alias FOXdialog {
if $dialog(FOX) != $null { dialog -v FOX }
else { dialog -mv FOX FOX }
.unset %fox.b1
.set %fox.b2 $lines(%FOXNews.output)
:next
inc %fox.b1
if %fox.b1 <= %fox.b2 {
did -a FOX 5 $read(%FOXNews.output,%fox.b1)
goto next
}
else { return }
}
dialog FOX {
title "[nI] FOXNews Headlines v2.1"
icon $scriptdir $+ FOXNews.ico
size -1 -1 350 170
option -dbu
text "Double-Clicking a Headline Will Open It In Your Browser...", 7, 10 145 325 6
box "FOXNews Headlines", 1, 5 1 340 152
list 5, 10 11 330 145, edit, autovs, extsel, autohs
button "CLOSE", 15, 310 156 30 11, cancel
button "Update", 17, 10 156 30 11, default
button "Copy HL", 19, 250 156 30 11, tab1
button "Copy URL", 21, 280 156 30 11, tab2
button "Send MSG", 23, 220 156 30 11, tab3
button "Go!", 25, 190 156 30 11, tab4
edit "http://www.FOXNews.com", 27, 41 156 148 11
menu "&File", 50
item "&Update", 60
item break, 70
item "&Save As...", 80
item break, 90, 50
item "&Close", 100, ok
menu "&Help", 110
menu "&Contact", 120, 110
item "&Visit Website", 130
item break, 140
item "&Send E-Mail", 150
item break, 160, 110
item "&About", 170
}
on *:DIALOG:FOX:sclick:*: {
if ($did == 5) {
did -t FOX 25
did -ra FOX 27 $read(%FOXNews.output2,$did(5).sel)
}
if ($did == 17) { getnews }
if ($did == 19) { clipboard $did(5).seltext }
if ($did == 21) { clipboard $read(%FOXNews.output2,$did(5).sel) }
if ($did == 23) && ($did(5).sel != $null) {
set %FOX.msgnick $?="Send this Headline to... "
if (%FOX.msgnick != $null) {
msg %FOX.msgnick [Headline] $did(5).seltext
msg %FOX.msgnick [url= $read(%FOXNews.output2,$did(5).sel)
}
}
if ($did == 25) && ($did(5).sel != $null) { url -n $read(%FOXNews.output2,$did(5).sel) }
else { halt }
}
on *:DIALOG:FOX:dclick:*: {
if ($did == 5) { url -n $read(%FOXNews.output2,$did(5).sel) }
else { halt }
}
on *:DIALOG:FOX:close:*: {
if $sock(FOX) != $null { sockclose FOX }
}
on *:DIALOG:FOX:menu:*: {
if ($did == 60) { getnews }
if ($did == 80) { saveheadlines }
if ($did == 130) { url -n [url=http://www.horiz0n.com/ni/]http://www.horiz0n.com/ni/] $read(%FOXNews.output2,$did(5).sel)
}
}
if ($did == 25) && ($did(5).sel != $null) { url -n $read(%FOXNews.output2,$did(5).sel) }
else { halt }
}
on *:DIALOG:FOX:dclick:*: {
if ($did == 5) { url -n $read(%FOXNews.output2,$did(5).sel) }
else { halt }
}
on *:DIALOG:FOX:close:*: {
if $sock(FOX) != $null { sockclose FOX }
}
on *:DIALOG:FOX:menu:*: {
if ($did == 60) { getnews }
if ($did == 80) { saveheadlines }
if ($did == 130) { url -n [url=http://www.horiz0n.com/ni/]
http://www.horiz0n.com/ni/[/url] }
if ($did == 150) { url -n
ZeroSyrge@horiz0n.com }
if ($did == 170) { foxaboutdialog }
}
alias FOXaboutdialog {
if $dialog(FOXabout) != $null { dialog -v FOXabout }
else { dialog -mvo FOXabout FOXabout }
}
dialog FOXabout {
title "[nI] FOXNews Headlines -- About"
icon $scriptdir $+ FOXNews.ico
size -1 -1 106 45
option -dbu
box "FOXNews Headlines", 1, 3 1 100 41
text "Version: 2.1", 3, 6 8 100 8
text "Author: ZeroSyrge", 5, 6 16 100 8
text "E-Mail:", 7, 6 24 25 8
text "URL:", 9, 6 32 25 8
link "ZeroSyrge@horiz0n.com", 11, 32 24 70 8
link "http://www.horiz0n.com/ni/", 13, 32 32 70 8
button "Close", 15, 71 5 30 11, cancel
}
on *:DIALOG:FOXabout:sclick:*:{
if ($did == 11) { url -n
ZeroSyrge@horiz0n.com }
if ($did == 13) { url -n
http://www.horiz0n.com/ni/ }
}
menu menubar,status,channel, {
-
[FOXNews]:/getnews
}