Skip to content
MSN Addons

Get NEWS from RSS into my bot

A TG007 community discussion started by nyt1972.

Discussion 13 posts
Page 1 of 1
Open
Topic #5350 · 13 published posts · 2,390 views

Hello,

 

I want a code to get NEWS from this RSS Feed into my bot from this link http://news.bbc.co.uk/rss/newsonline_uk_ed...n/world/rss.xml, when some one type @news.

 

this should help. if the link doesn't work it's a tutorial from ms org called "retrieving data with sockets" by jagfire.

People are like slinkies; they're generally boring until you push them down stairs

I have made an rss feed read for tg , i might be able to find time to modify it to read any rss feed

My code does NOT have bugs. It just develops random features.

Hello,

 

I got this code from this line Angelia gave, now need 2 edit it to show the news in the msn chat room when some one type @news.

 

I cat do it my self, m a dull but I like to do new things with my bot.

 

menu menubar {
 RSS News Feed
 .BBC News UK
 ..$submenu($RSSparsemenu($1, BBC))
 .CNN
 ..$submenu($RSSparsemenu($1, CNN))
 .International Herald Tribune
 ..$submenu($RSSparsemenu($1, IHT))
 .-
 .Retrieve headlines: retrieveHeadlines
}

alias -l retrieveHeadlines {
 getRSSfeed BBC newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml
 getRSSfeed IHT www.iht.com/rss/frontpage.xml
 getRSSfeed CNN rss.cnn.com/rss/cnn_topstories.rss
}

on *:connect:{ retrieveHeadlines }
alias RSSparsemenu {
 if (e isin $1) return
 if ($1 < 2) return :
 var %str = $hget(RSS_ $+ $2, $1), $&
   %title = $wildtok(%str, title:*, 1, 1), $&
   %link = $wildtok(%str, link:*, 1, 1)
 %title = $gettok(%title, 2-, 58)
 %link = $gettok(%link, 2-, 58)
 return $replace(%title, :, -) :url -n %link
}
; /getRSSfeed <source> <url>
alias getRSSfeed {
 var %a, %b
 %a = $gettok($2, 1, 47)
 %b = $gettok($2, 2-, 47)
 sockopen %a %a 80
 sockmark %a RSS_ $+ $1 %b
 echo Connecting to %a
 if ($hget(RSS_ $+ $1)) hfree RSS_ $+ $1
}
on *:sockopen:*:{
 tokenize 32 $sock($sockname).mark
 if (RSS_* !iswm $1) { return }
 if ($sockerr) {
   echo Closed socket $sockname $sock($sockname).wsmsg
   return
 }
 echo Attempting to retrieve $2-
 sockwrite -n $sockname GET / $+ $2- HTTP/1.0 $+ $crlf $+ $crlf
 unset %rsspop
}
on *:sockread:*:{
 tokenize 32 $sock($sockname).mark
 if (RSS_* !iswm $1) { return }
 if ($sockerr > 0) return
 :nextread
 sockread %RSSread
 if ($sockbr == 0) return
 if (%RSSread == $null) %RSSread = -
 var %r = .*\<(title|link)\>(.*)\<\/(title|link)\>.*
 if ($regex(%RSSread, %r)) {
   set %rsspop $addtok(%rsspop, $regml(1) $+ : $+ $regml(2), 1)
   if ($numtok(%rsspop, 1) == 2) {
     hadd -m $1 $calc($hget($1, 0).item + 1) %rsspop
     unset %rsspop
   }
 }
 goto nextread
}
on *:sockclose:*:{
 if ($sockerr) echo Closed socket $sockname ( $+ $sock($sockname).wsmsg $+ )
 else echo Closed socket $sockname
}

Why no body answering me, lot of gurus are here and still m not not getting any reply.

 

plz do reply.

if you try send rss feed to a room its going to flood cause most come with topioc and a discription and about 10 news items

 

 

and that gets 3 feeds so will be about 30 items atleast

My code does NOT have bugs. It just develops random features.

if you try send rss feed to a room its going to flood cause most come with topioc and a discription and about 10 news items

and that gets 3 feeds so will be about 30 items atleast

 

I loaded the above code to my kenobi script but its not working, and I will remove the other 2 feeds coz I need only bbc.

 

Can any one edit it for me to work in kenobi when I type @news , it shuld display bbc news in chat room.

I am very much disappointed now bcoz among 2 many gurus I didnt get my reply yet.

am sorry but i have been busy , as a lot of us are and we offer our free time to answer questions.

so please be patient.

 

It also looks like you havnt pasted the full code.

Edited Dec 5, 2005 4:12 PM by Ozzy10

My code does NOT have bugs. It just develops random features.

if ur dissapointed in them not answering you properly and they are helping you enough as they can if you cant do anything for yourself go get help somwhere else.

that code has something missing as i dont see an echo to script or anything

It looks like it sends it to a hash table

My code does NOT have bugs. It just develops random features.

coincidently, there's a recent addon posted on ms org that lets you read rss. you might wanna try that

People are like slinkies; they're generally boring until you push them down stairs

Ok thanx Angelia I got the script from Rumbaar site, and its working fine.