mIRC Home    About    Download    Register    News    Help

Print Thread
#210290 10/03/09 08:40 PM
Joined: Nov 2006
Posts: 143
X
xyzzy Offline OP
Vogon poet
OP Offline
Vogon poet
X
Joined: Nov 2006
Posts: 143
Code:
alias rss {
var %e = !echo $color(info) -a * Rss:, %r = return $false
if ($os isin 9598) { %e this snippet requires Windows ME or higher | %r }
if ($version < 5.91) { %e this snippet requires atleast mIRC 5.91 or higher | %r }
if (!$regex(%e,$1-,/^-[fhi] \S+ \S+$/i)) {
%e Syntax: /rss <-fhi> <url> <file|htb> or $!rss(-fhi, url, file|htb) | %r
}
var %flag = $mid($1,2), %filepath
if (%flag == h) %filepath = " $+ $mircdirtmprss"
else {
var %dir = $nofile($3-), %file = $nopath($3-)
if (%file != $mkfn(%file)) { %e file %file contains illegal characters. | %r }
if (* !iswm %dir) %dir = $mircdir
elseif (!$isdir(%dir)) { %e no such folder %dir | %r }
%filepath = $+(",%dir,%file,")
}
var %w = $+(@rss,$ticks,$r(1111,9999),.vbs), %a = aline %w, %size, %n = $lf
write -c %filepath
window -h %w
%a Function nohtml(byref string)
%a set regex = new regexp
%a regex.global = true : regex.pattern = "<[^>]*>|[\r\n\177]+" : nohtml = regex.replace(string,"")
%a set regex = nothing
%a End Function
%a set xml = createobject("msxml.domdocument") : set ado = createobject("adodb.stream")
%a ado.open : ado.type = 2 : ado.charset = "ascii"
%a xml.validateonparse = false : xml.async = false : xml.load " $+ $2"
%a for each item in xml.getelementsbytagname("item")
if (%flag == i) {
%a i = i + 1
%a ado.writetext "[" & i & "]",1
%a for each node in item.childnodes
%a if node.text <> "" then ado.writetext node.nodename & "=" & nohtml(node.text),1
%a next %n ado.writetext vbcrlf
}
else {
%a for each node in item.childnodes
%a name = node.nodename
%a if name = "aç&#305;klama" then %n desc = name & ": " & nohtml(node.text)
%a elseif name = "adres" or name = "Ba&#351;l&#305;k" then %n tmp = tmp & name & ": " & nohtml(node.text) & chr(127)
%a end if %n next
if (%flag == h) %a i = i + 1 %n ado.writetext i & chr(10) & left(tmp & desc,920) & chr(10)
else %a ado.writetext left(tmp & desc,920) & vbcrlf
%a tmp = null
}
%a next %n ado.savetofile %filepath ,2 : ado.close %n set ado = nothing : set xml = nothing
savebuf %w %w | close -@ %w
.comopen %w wscript.shell
if (!$comerr) .comclose %w $com(%w,run,1,bstr*,%w,uint,0,bool,true)
.remove %w
if (%flag == h) {
if ($hget($3)) hfree $3
hmake $3
hload $3 %filepath
.remove %filepath
%size = $hget($3,0).item
}
else %size = $file(%filepath)
if ($isid) return $iif(%size,$true,$false)
if ($show) {
if (!%size) msg %rss websitesinden verilere ulasilamiyor. $2
;else %e Finished retrieving info from $2 (saved to $iif(%flag == h,hash table:,file $3-)
}
return
:error
if ($com(%w)) .comclose %w
if ($isfile(%w)) .remove %w
if ($window(%w)) close -@ %w
}
alias degistir { say $replace($1-,GMT,$null,$1,$null,apr,nis,agu,agustos,jan,ocak,f eb,&#351;ubat,mar,mart,may,mayis,jun,haziran,jul,temmuz ,sep,eylül,oct,ekim,nov,kas&#305;m,dec,aral&#305;k,Mon,Pazar tesi,Tue,Sali,Wed,Carsamba,Thu,Persembe,Fri,Cuma,S at,Cumartesi,Sun,Pazar,title=,04Konu Ba&#351;l&#305;&#287;&#305;:02,description=,4Aç&#305;klama:02,pubdate=, 04Tarih:02,link=,$+(04Devami icin:02,$chr(32))) }
alias _rmsg {
if !%a { set %a 1 } | else { inc %a | msg $1 $chr(160) | msg $1 $chr(160) }
$iif($readini(Dünya.txt,%a,title),.play $+(-at,%a) degistir $1 Dünya.txt,durdur)
}
on *:text:!Dünya*:#: {
if $2 == Gündem {
if $timer(rss) { msg $chan Sondakika haberleri zaten acik! | halt }
else {
var %z = $shortfn($mircdirDünya.txt),%a = 1 | if $exists(%z) { .remove %z }
rss -i http://www.cnnturk.com/servisler/rss/dunya.rss Dünya.txt | msg # 13,13 0,6 CnnTürk ( Dünya Gündemi , neler oluyor dünya'da¿ ) Özetlerinin Ak&#305;&#351;&#305; Ba&#351;lat&#305;ld&#305;.13,13  | .timerrss 0 120 _rmsg $chan
}
}
if $2 == dur && $timer(rss) { .timerrss off | msg #KanalAd&#305; 13,13 0,6 CnnTürk ( Dünya Gündemi ) Özetlerinin Ak&#305;&#351;&#305; Durduruldu.13,13  | halt }
}
alias durdur { .timerrss off | unset %a }

i used the code to get news just got some problem with it
i just want to change the site to
http://www.kelebekhaber.com/rss.asp
when i type !news in the channel wanna all the news and links of
them and want it keep watching the updates of site and if
any news updated wanna it just give latest any idea ?

xyzzy #210430 15/03/09 02:41 PM
Joined: Nov 2006
Posts: 143
X
xyzzy Offline OP
Vogon poet
OP Offline
Vogon poet
X
Joined: Nov 2006
Posts: 143
anyone at home ?


Link Copied to Clipboard