|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
Sujet : flux RSS [ Archives / Scripting ] (yob666)
Informations & options pour cette discussion
|
jeudi 15 juillet 2004 à 17:59:38 |
flux RSS

yob666
|
Bonjour, voila je cherche à afficher sur IRC des news diffusées sur le web en RSS au moyen d'un tcl pour eggdrop, seul probleme je n'ai pas reussi a trouver un quelconque exemple de script tcl utilisant le RSS d'ou la question suivante: ou puis-je trouver ce script ou ou trouver des informations afin de pouvoir le realiser Merci d'avance à ceux qui répondrons
|
|
|
|
vendredi 16 juillet 2004 à 18:57:48 |
Re : flux RSS

opgang
|
Il n'en existe apparement pas....
Amuse toi à faire le premier, tu me l'enverras ;)
|
|
|
|
vendredi 16 juillet 2004 à 19:13:06 |
Re : flux RSS

opgang
|
Il n'en existe apparement pas....
Amuse toi à faire le premier, tu me l'enverras ;)
|
|
|
|
mardi 27 juillet 2004 à 22:35:55 |
Re : flux RSS

maaars
|
Réponse acceptée !
plop cadeau, qui est pas de moi bien evidement ;) ## $Id: rssnews.tcl,v 1.401 2004/07/17 17:06:41 perpleXa Exp $ ## ## http://perpleXa.net | http://dev.perpleXa.net ## #perpleXa on QuakeNet ## (C) 2004 ## ## This script is approved to catch all valid RSS feeds. ## Default setup is to catch news from deviantART.com. ## If You have any suggestions or bugs please visit ## me on QuakeNet and tell me your wish/problem. ## ## Note: I will NOT make a version which supports ## several feeds at once. ## So please don't ask for it. ## ## I've made really huge changes in v1.4, which are not ## easy to track, if you find any bugs or stuff, which ## seems to make failures so notice me! ## ## Version History: ## ## 1.401 - 2004-07-17 ## ## - added: debug mode (makes it easier to track bugs) ## ## 1.400 - 2004-07-15 ## ## - improved: all regular expressions (regex). ## - changed: replaced all "string first" with regex. ## - changed: public triggers post to the channel, ## message triggers post private (due to many requests). ## - added: output layout on triggers can now be changed. ## ## 1.304 - 2004-07-13 ## ## - fixed: colors get removed on all chans if +c is set on just one of them. ## ## 1.303 - 2004-07-10 ## ## - fixed: file doesn't get closed, if there are news available. ## ## 1.302 - 2004-07-01 ## ## - fixed: sock doesn't get closed, if the limit is above the ## news items, which are included in the file. ## ## 1.301 - 2004-06-30 ## ## - improved: regex, which splits the url. ## - improved: file handling if the host is unreachable. ## - changed: default output design. ## - changed: all variables are now an array (rss). ## - added: a check if the directory exists, which is used by the file, ## it will be created, if it does not exist. ## - added: version history :P ## ## 1.2xx - 2004-06-xx ## ## - fixed: bug, which replaced every "&" in an url with ie. <link> ## - fixed: bug, which caused the script to brake, ## after it has checked the url once. ## - added: seperated triggers (message and public). ## ## 1.1xx - 2004-05-xx ## ## - improved: replaced setup for each part of the url with a unique one. ## - added: user defined layout. ## - added: auto remove of control codes if chanmode +c is set. ## ## 1.0xx - 2004-04-xx ## ## - Initial release, really buggy - never been public.. ##
################## ##### config #####
## the location of the news ## in the format http://domain.com/file.xml:port ## note: port value is optional. set rss(feedurl) "http://hyperlinkextractor.free.fr/rssfiles/yahoo_france.xml"
## the file where the news are saved set rss(file) "scripts/dbase/rssnews"
## on which channels should the script be activated? ## "" is for all channels the bot is on. set rss(chans) "#Eelai"
## on which commands should the script trigger (setup public and message triggers)? set rss(pubtriggers) {$news} set rss(msgtriggers) {news}
## post news on channels? 1(yes)/0(no) set rss(newspost) "1"
## how many news should be posted on channels? set rss(newspostlimit) "5"
## how many news should be privmessaged on triggers? set rss(publimit) "5" set rss(msglimit) "10"
## define the layout ## you can use: <publisher> <news> <link> ## for colors or control codes use: ## \002 bold ## \003 [00-15] colors ## \017 reset control codes ## \026 reverse ## \037 underline set rss(layout) "\002 Actualités - France :\017 <news> \00314\037<link>" ## Note: You can also use <id> on triggered output. set rss(triggerlayout) "\002 Actualités - France :\017 <news> \00314\037<link>"
## Debug mode (to display status messages on the partyline) set rss(debug) "1"
##### end of config ##### #########################
foreach trigger [split $rss(pubtriggers) { }] {bind pub - $trigger pub_rss} foreach trigger [split $rss(msgtriggers) { }] {bind msg - $trigger msg_rss} catch {unset trigger}
bind time - "?0 * * * *" rsscheck
proc rsscheck {min hour day week year} { global rss set counter 0 if {$rss(newspost) == 1 } { regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(feedurl) tmp pro rss(url) rss(feed) tmp rss(port) if {$rss(port) == ""} {set rss(port) 80} if {$rss(debug) == 1} { putlog "RSS: searching news on $rss(url) (port: $rss(port))" } set rss(lastnews) "none" regexp -- {(\S+/)?} $rss(file) tmp rss(dir) if {$rss(dir) != ""} { if {![file isdirectory $rss(dir)]} { file mkdir $rss(dir) if {$rss(debug) == 1} { putlog "RSS: created directory: $rss(dir)" } } } if {[file exists $rss(file)]} { set temp [open "$rss(file)" r] set rss(lastnews) "[gets $temp]" if {$rss(lastnews) == ""} {set rss(lastnews) "none"} close $temp } if {[catch {set sock [socket $rss(url) $rss(port)]} sockerror]} { if {$rss(debug) == 1} { putlog "RSS: error: $sockerror" } return } else { set limit $rss(msglimit) if {$limit < $rss(newspostlimit)} {set limit $rss(newspostlimit)} if {$limit < $rss(publimit)} {set limit $rss(publimit)} set temp [open "$rss(file)" w+] puts $sock "GET $rss(feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { if {$counter == $limit} {break} set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { regsub -all -- {<publisher>} $rss(layout) $publisher rss(output) regsub -all -- {<news>} $rss(output) $newsline rss(output) regsub -all -- {<link>} $rss(output) $newslink rss(output) puts $temp "$rss(output)" set getfeed 0 ; incr counter } } } } close $sock ; close $temp ; set counter 0 set temp [open "$rss(file)" r] while {[eof $temp] != 1} { set rss(newline) [gets $temp] if {($rss(lastnews) == $rss(newline)) || ($counter == $rss(newspostlimit))} { if {$rss(debug) == 1} { putlog "RSS: No news found." } close $temp; return } incr counter foreach chan [channels] { if {$rss(chans) == ""} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(newline) "" rss(outline) } else { set rss(outline) $rss(newline) } putserv "PRIVMSG $chan :$rss(outline)" } else { if {[lsearch -exact [string tolower $rss(chans)] [string tolower $chan]] != -1} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(newline) "" rss(outline) } else { set rss(outline) $rss(newline) } putserv "PRIVMSG $chan :$rss(outline)" } } } } close $temp } }
proc rssnews {target limit} { global rss regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(feedurl) tmp pro rss(url) rss(feed) tmp rss(port) if {$rss(port) == ""} {set rss(port) 80} if {[catch {set sock [socket $rss(url) $rss(port)] } sockerror]} { if {$rss(debug) == 1} { putlog "RSS: error: $sockerror" } return } else { puts $sock "GET $rss(feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { set getfeed 0 ; incr counter regsub -all -- {<publisher>} $rss(triggerlayout) $publisher rss(output) regsub -all -- {<news>} $rss(output) $newsline rss(output) regsub -all -- {<link>} $rss(output) $newslink rss(output) regsub -all -- {<id>} $rss(output) $counter rss(output) putserv "PRIVMSG $target :$rss(output)" } } if {$counter == $limit} {break} } close $sock } }
proc cleanstring {string method} { regsub -all -- {<.+?>} $string {} string ; regsub -all -- {\t} $string {} string if {($method == 1)} {regsub -all -- {\&} $string {\\\&} string} set string [string map { " " < < > > & & " \" ' \" ä ä Ä Ä ö ö Ö Ö ü ü Ü Ü ß ß} $string] return $string }
proc msg_rss {nick uhost hand arg} { global rss rssnews $nick $rss(msglimit) }
proc pub_rss {nick uhost hand chan arg} { global rss if {([lsearch -exact [string tolower $rss(chans)] [string tolower $chan]] != -1) || ($rss(chans) == "")} { rssnews $chan $rss(publimit) } }
putlog "Script loaded: RSS feed catcher. (C) 2004 perpleXa"
|
(' ' )
|
|
|
|
lundi 16 août 2004 à 02:07:38 |
Re : flux RSS

ToNtOnYoYo
|
heu salut... deja merci pour le code TCL !! mais j'ai un ptit problem... je voudrais récuppéré deux flux rss avec le meme Eggdrop... donc avec le meme script !!
donc j'ai modifié les deux addresses des flux rss mais ca ne marche pas .... j'ai vu quelquepart qu'il fallait modifier les proc ... ce que j'ai fais mais qui ne marche toujours pas !!
et donc désepéré j'ai modifié chaque variable !! mais ca ne marche pas non plus !!
Es ce que quelqu'un saurait comment faire ?? svp merci d'avance !! j'attends avec impatience les réponses ;) A+
|
|
|
|
lundi 16 août 2004 à 18:34:02 |
Re : flux RSS

maaars
|
En fait il faut renomer tous les "$rss" et comme je suis gentil (et surtout parce que je l'ai deja fait pour moi je t'en file un modif (apres si tu veut mettre un 3e feed tu fait "ctrl+F" et tu recherche tous les 001) perso mon egg tourne avec 26 feed catcher et ca tourne super bien ;) ## ## met ici le thème du feed (ca aide quand on a bcp de feed) ## met ici l'url du site (ca aide quand on a bcp de feed) ##
## adresse rss du site set rss(001feedurl) "http://www.ton-fedd-rss"
## fichier de back-up set rss(001file) "scripts/news/rss-news-001"
## salon ou sont affiché les infos set rss(001chans) "#info"
## triggers reconnus ( 1er chan, 2e pv ) set rss(001pubtriggers) {/001} set rss(001msgtriggers) {manga}
set rss(001newspost) "1"
## nombre de news postées en même temps set rss(001newspostlimit) "5"
## nombre de news postées en même temps quand un trigger est utilisé set rss(001publimit) "5" set rss(001msglimit) "10"
## Affichage de la news ## Les triggers possibles <publisher> <news> <link> ## Les codes couleurs ## \002 gras ## \003 [00-15] couleurs ## \017 remise a zéro ## \026 reverse ## \037 souligné set rss(001layout) "\002 \0033,0\[\0031Titre de ta news\0033\] :\017\0031,0 <news> \00314<link>" set rss(001triggerlayout) "\002 \0033,0\[\0031Titre de ta news\0033\] :\017\0031,0 <news> \00314<link>"
set rss(001debug) "1"
##### Pas toucher apres sinon ca marche plus #####
foreach trigger [split $rss(001pubtriggers) { }] {bind pub - $trigger pub_rss-001} foreach trigger [split $rss(001msgtriggers) { }] {bind msg - $trigger msg_rss-001} catch {unset trigger}
bind time - "?0 * * * *" rsscheck-001
proc rsscheck-001 {min hour day week year} { global rss set counter 0 ## timer pour un nouveau scan du site (le 1 veut dire 10 minutes) if {$rss(001newspost) == 1 } { regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(001feedurl) tmp pro rss(001url) rss(001feed) tmp rss(001port) if {$rss(001port) == ""} {set rss(001port) 80} if {$rss(001debug) == 1} { putlog "RSS: searching news on $rss(001url) (port: $rss(001port))" } set rss(001lastnews) "none" regexp -- {(\S+/)?} $rss(001file) tmp rss(001dir) if {$rss(001dir) != ""} { if {![file isdirectory $rss(001dir)]} { file mkdir $rss(001dir) if {$rss(001debug) == 1} { putlog "RSS: created directory: $rss(001dir)" } } } if {[file exists $rss(001file)]} { set temp [open "$rss(001file)" r] set rss(001lastnews) "[gets $temp]" if {$rss(001lastnews) == ""} {set rss(001lastnews) "none"} close $temp } if {[catch {set sock [socket $rss(001url) $rss(001port)]} sockerror]} { if {$rss(001debug) == 1} { putlog "RSS: error: $sockerror" } return } else { set limit $rss(001msglimit) if {$limit < $rss(001newspostlimit)} {set limit $rss(001newspostlimit)} if {$limit < $rss(001publimit)} {set limit $rss(001publimit)} set temp [open "$rss(001file)" w+] puts $sock "GET $rss(001feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(001url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { if {$counter == $limit} {break} set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring-001 $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring-001 $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring-001 $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { regsub -all -- {<publisher>} $rss(001layout) $publisher rss(001output) regsub -all -- {<news>} $rss(001output) $newsline rss(001output) regsub -all -- {<link>} $rss(001output) $newslink rss(001output) puts $temp "$rss(001output)" set getfeed 0 ; incr counter } } } } close $sock ; close $temp ; set counter 0 set temp [open "$rss(001file)" r] while {[eof $temp] != 1} { set rss(001newline) [gets $temp] if {($rss(001lastnews) == $rss(001newline)) || ($counter == $rss(001newspostlimit))} { if {$rss(001debug) == 1} { ## echo personalisé putlog "RSS 001 Plus de nouvelles news manga trouvées" } close $temp; return } incr counter foreach chan [channels] { if {$rss(001chans) == ""} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(001newline) "" rss(001outline) } else { set rss(001outline) $rss(001newline) } putserv "PRIVMSG $chan :$rss(001outline)" } else { if {[lsearch -exact [string tolower $rss(001chans)] [string tolower $chan]] != -1} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(001newline) "" rss(001outline) } else { set rss(001outline) $rss(001newline) } putserv "PRIVMSG $chan :$rss(001outline)" } } } } close $temp } }
proc rssnews-001 {target limit} { global rss regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(001feedurl) tmp pro rss(001url) rss(001feed) tmp rss(001port) if {$rss(001port) == ""} {set rss(001port) 80} if {[catch {set sock [socket $rss(001url) $rss(001port)] } sockerror]} { if {$rss(001debug) == 1} { putlog "RSS: error: $sockerror" } return } else { puts $sock "GET $rss(001feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(001url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring-001 $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring-001 $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring-001 $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { set getfeed 0 ; incr counter regsub -all -- {<publisher>} $rss(001triggerlayout) $publisher rss(001output) regsub -all -- {<news>} $rss(001output) $newsline rss(001output) regsub -all -- {<link>} $rss(001output) $newslink rss(001output) regsub -all -- {<id>} $rss(001output) $counter rss(001output) putserv "PRIVMSG $target :$rss(001output)" } } if {$counter == $limit} {break} } close $sock } }
proc cleanstring-001 {string method} { regsub -all -- {<.+?>} $string {} string ; regsub -all -- {\t} $string {} string if {($method == 1)} {regsub -all -- {\&} $string {\\\&} string} set string [string map { " " < < > > & & " \" ' \" ä ä Ä Ä ö ö Ö Ö ü ü Ü Ü ß ß} $string] return $string }
proc msg_rss-001 {nick uhost hand arg} { global rss rssnews-001 $nick $rss(001msglimit) }
proc pub_rss-001 {nick uhost hand chan arg} { global rss if {([lsearch -exact [string tolower $rss(001chans)] [string tolower $chan]] != -1) || ($rss(001chans) == "")} { rssnews-001 $chan $rss(001publimit) } }
putlog "RSS feed catcher by perpleXa - multi-feed-001 by Melchizedek Loaded"
|
voila (' ' )
|
|
|
|
lundi 16 août 2004 à 19:39:43 |
Re : flux RSS

ToNtOnYoYo
|
c super simpa de ta part... je suis en train d'essayer... je te tien au courant !! merci encore!! je me suis tellement fait chier sur ce truc ^^
A+
|
|
|
|
mardi 17 août 2004 à 00:48:13 |
Re : flux RSS

ToNtOnYoYo
|
voila j'ai fais ce ke tu ma dis... où est le probleme ?? je comprends pas >_<
################## ##### config #####
## the location of the news ## in the format http://domain.com/file.xml:port ## note: port value is optional. set rss(001feedurl) "www.pcinpact.com/include/news.xml"
## the file where the news are saved set rss(001file) "scripts/rssnews-db-001"
## on which channels should the script be activated? ## "" is for all channels the bot is on. set rss(001chans) "#eggdrop"
## on which commands should the script trigger (setup public and message triggers)? set rss(001pubtriggers) {/001} set rss(001msgtriggers) {news}
set rss(001newspost) "1"
## how many news should be posted on channels? set rss(001newspostlimit) "5"
## how many news should be privmessaged on triggers? set rss(001publimit) "5" set rss(001msglimit) "10"
## define the layout ## you can use: <publisher> <news> <link> ## for colors or control codes use: ## \002 bold ## \003 [00-15] colors ## \017 reset control codes ## \026 reverse ## \037 underline set rss(001layout) "\002 PCinpacT:\017 <news> \00314\037<link>" ## Note: You can also use <id> on triggered output. set rss(001triggerlayout) "\002 PcinpacT :\017 <news> \00314\037<link>"
## Debug mode (to display status messages on the partyline) set rss(001debug) "1"
##### end of config ##### #########################
foreach trigger [split $rss(001pubtriggers) { }] {bind pub - $trigger pub_rss-001} foreach trigger [split $rss(001msgtriggers) { }] {bind msg - $trigger msg_rss-001} catch {unset trigger}
bind time - "?0 * * * *" rsscheck-001
proc rsscheck-001 {min hour day week year} { global rss set counter 0 if {$rss(001newspost) == 1 } { regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(001feedurl) tmp pro rss(001url) rss(001feed) tmp rss(001port) if {$rss(001port) == ""} {set rss(001port) 80} if {$rss(001debug) == 1} { putlog "RSS: searching news on $rss(001url) (port: $rss(001port))" } set rss(001lastnews) "none" regexp -- {(\S+/)?} $rss(001file) tmp rss(001dir) if {$rss(001dir) != ""} { if {![file isdirectory $rss(001dir)]} { file mkdir $rss(001dir) if {$rss(001debug) == 1} { putlog "RSS: created directory: $rss(001dir)" } } } if {[file exists $rss(001file)]} { set temp [open "$rss(001file)" r] set rss(001lastnews) "[gets $temp]" if {$rss(001lastnews) == ""} {set rss(001lastnews) "none"} close $temp } if {[catch {set sock [socket $rss(001url) $rss(001port)]} sockerror]} { if {$rss(001debug) == 1} { putlog "RSS: error: $sockerror" } return } else { set limit $rss(001msglimit) if {$limit < $rss(001newspostlimit)} {set limit $rss(001newspostlimit)} if {$limit < $rss(001publimit)} {set limit $rss(001publimit)} set temp [open "$rss(001file)" w+] puts $sock "GET $rss(001feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(001url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { if {$counter == $limit} {break} set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { regsub -all -- {<publisher>} $rss(001layout) $publisher rss(001output) regsub -all -- {<news>} $rss(001output) $newsline rss(001output) regsub -all -- {<link>} $rss(001output) $newslink rss(001output) puts $temp "$rss(001output)" set getfeed 0 ; incr counter } } } } close $sock ; close $temp ; set counter 0 set temp [open "$rss(001file)" r] while {[eof $temp] != 1} { set rss(001newline) [gets $temp] if {($rss(001lastnews) == $rss(001newline)) || ($counter == $rss(001newspostlimit))} { if {$rss(001debug) == 1} { putlog "RSS: No news found." } close $temp; return } incr counter foreach chan [channels] { if {$rss(001chans) == ""} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(001newline) "" rss(001outline) } else { set rss(001outline) $rss(001newline) } putserv "PRIVMSG $chan :$rss(001outline)" } else { if {[lsearch -exact [string tolower $rss(chans)] [string tolower $chan]] != -1} { if {[regexp -- {c} [getchanmode $chan]]} { regsub -all -- {\003[\d]{0,2}(,[\d]{0,2})?|\002|\037|\017|\026|\006|\007} $rss(newline) "" rss(001outline) } else { set rss(001outline) $rss(001newline) } putserv "PRIVMSG $chan :$rss(001outline)" } } } } close $temp } }
proc rssnews-001 {target limit} { global rss regexp -nocase -- {^(http://)?(\S*\.[a-zA-Z]{2,3})(/.+?)(\:([0-9]+))?$} $rss(001feedurl) tmp pro rss(001url) rss(001feed) tmp rss(001port) if {$rss(001port) == ""} {set rss(001port) 80} if {[catch {set sock [socket $rss(001url) $rss(001port)] } sockerror]} { if {$rss(001debug) == 1} { putlog "RSS: error: $sockerror" } return } else { puts $sock "GET $rss(001feed) HTTP/1.1" puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" puts $sock "Host: $rss(001url)" puts $sock "" flush $sock set counter 0 ; set getfeed 0 while {(![eof $sock])} { set bl [gets $sock] if {[regexp -nocase -- {<item\s.+?>|<item>} $bl]} {set getfeed 1} if {$getfeed == 0} { if {[regexp -nocase -- {<title>.+</title>} $bl]} {set publisher [cleanstring $bl 1]} } elseif {$getfeed == 1} { if {[regexp -nocase -- {<link>.+</link>} $bl]} {set newslink [cleanstring $bl 1]} if {[regexp -nocase -- {<title>.+</title>} $bl]} {set newsline [cleanstring $bl 1]} if {[regexp -nocase -- {</item>} $bl]} { set getfeed 0 ; incr counter regsub -all -- {<publisher>} $rss(001triggerlayout) $publisher rss(001output) regsub -all -- {<news>} $rss(001output) $newsline rss(001output) regsub -all -- {<link>} $rss(001output) $newslink rss(001output) regsub -all -- {<id>} $rss(001output) $counter rss(001output) putserv "PRIVMSG $target :$rss(001output)" } } if {$counter == $limit} {break} } close $sock } }
proc cleanstring-001 {string method} { regsub -all -- {<.+?>} $string {} string ; regsub -all -- {\t} $string {} string if {($method == 1)} {regsub -all -- {\&} $string {\\\&} string} set string [string map { " " < < > > & & " \" ' \" ä ä Ä Ä ö ö Ö Ö ü ü Ü Ü ß ß} $string] return $string }
proc msg_rss-001 {nick uhost hand arg} { global rss rssnews $nick $rss(001msglimit) }
proc pub_rss-001 {nick uhost hand chan arg} { global rss if {([lsearch -exact [string tolower $rss(001chans)] [string tolower $chan]] != -1) || ($rss(001chans) == "")} { rssnews $chan $rss(001publimit) } }
|
:'( :'(
|
|
|
|
mercredi 18 août 2004 à 00:30:46 |
Re : flux RSS

ToNtOnYoYo
|
bon enfait comme ca marchait pas.. j'ai pris le code que tu ma mis ... j'ai juste changé l'addresse du flux.... et rien ne marche ... je cromprends pas >_< !! l'url du rss marche je l'ai vérifié;. c'est sur kelle fonctionne ... donc je vois pas ce qui cloche .. surtout que tu dis que chez toi ca marche :'(
help me plizzzzzzz !!
(comme c'est un peu galere par le forum ... si kelkun pouvait m'aider par MSN ca serait cool mon addresse : tontonyoyo@hotmail.com ) merci d'avance !!
|
|
|
|
jeudi 19 août 2004 à 16:00:16 |
Re : flux RSS

maaars
|
espece de mauvais va :p si tu avais regardé ce que disai ton egg (la fenetre dos) tu aurai vu "error cleanstring" et donc tu te serai rendu compte que ton "cleanstring" devrai s'appeller "cleanstring-001" :p alalalalalalala enfin bon c'est pas grave je te conseil de laisser le putlog comme ca quand t'as un bug tu vois tout de suite quel TCL par en live ('' )
|
|
|
Cette discussion est classé dans : script, trouver, rss, flux, tcl
Répondre à ce message
Sujets en rapport avec ce message
[TCL] Script eggdrop de log de channels [ par Psyk ]
Bonjour,Je suis actuellement à la recherche d'un développeur en TCL pour adapter un script de log de channel de sorte qu'il permette de générer des st
tcl script [ par Solisoft ]
Salut a tous,Je recherche quelqu'un qui sais coder en tcl pour un script, j'ai fait pas mal de recherche mais je ne trouve personne (beaucoup moin évi
Script TCL VIP BOT [ par DetaX ]
Bonjour tout le monde j'ai chercher sur google sur Qnet et je trouves pas de codeur TCL. J'aurai besoin d'un bot ViP Comme ceux de : http://www.sicher
recherche script anti-lien [ par madoudou ]
bonjour,moi je cherche un script anti-lien et j'arrive pas a trouver. Pouvez m'aidez ou me dire ou je peut en trouver. merci
Script TCL [ par tettete ]
Bonsoir , je recherche un codeur TCL car jai besoin daide pour mon eggdrop je veut que quelqun me mete ce script : on *:join:#canal: $iif($nick != pse
script.tcl + eggdrop : besoin d'aide ... [ par wolfsters ]
Bonjour, je post sur le forum car j'ai besoin d'aide concernant un script.tcl qui ne fonctionne pas :- Je possede un eggdrop- Je possede un script .tc
Bot lisant les fichiers xml (flux rss) [ par killyox666 ]
Bonjour à tous, Je suis actuellement à la recherche d'un bot irc (mIRC de preference), qui sait lire les fichiers .XML se trouvant sur le net. Ce que
Bind avec ponctuation pour script TCL [ par spoker91 ]
Salut à tousJe voudrais que quand la personne ecrit sa:.:: Bonjour ::. (avec les points etc..)sa me lance une procedurej'ai donc fait ça:bind pub - ".
News Flux RSS [ par shunny ]
Bonjour,Je me présente je suis pas fort en script irc :'(Je voudrais savoir si il été possible de créer une remote. car moi les TCL et les eggdrop je
Script d'action [ par TheoDaOuf ]
Bonjour !Je cherche à faire quelque chose qui me semble très simple, mais dont je n'ai pas réussi à trouver la moindre trace en une heure de recherche
Livres en rapport
|
Téléchargements
Logiciels à télécharger sur le même thème :
|