<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17309" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-11-13T12:09:29-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17309</id>

		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-11-13T12:09:29-04:00</updated>

		<published>2009-11-13T12:09:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90893#p90893</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90893#p90893"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90893#p90893"><![CDATA[
Hopefully, to give you some ideas of file reading the following script provides a public command !xml that extracts data from a file. I used the xml data you pasted above to create a file whatever.xml in the bot's root directory.<br><div class="codebox"><p>Code: </p><pre><code>bind PUB - !xml pXMLReadproc pXMLRead {nick uhost hand chan text} {    set fp [open whatever.xml r]    set data [split [read -nonewline $fp] \n]    close $fp    foreach line $data {        if {[regexp -- {&lt;title&gt;([^&lt;]+)&lt;/title&gt;} $line -&gt; title]} {continue}        if {[regexp -- {&lt;pubDate&gt;([^&lt;]+)&lt;/pubDate&gt;} $line -&gt; pubDate]} {continue}    }    if {[info exists title]} {putserv "PRIVMSG $chan :last title = $title"}    if {[info exists pubDate]} {putserv "PRIVMSG $chan :last pubDate = $pubDate"}    return 0}</code></pre></div>The IRC output is shown below :-<br><blockquote class="uncited"><div>[16:01] &lt;@arfer&gt; !xml<br>[16:01] &lt;@osmosis&gt; last title = Piotr JIIIS Wojtowicz manufactured an item (Simple II Plastic Springs) worth 97 PED!<br>[16:01] &lt;@osmosis&gt; last pubDate = Fri, 13 Nov 2009 14:17:16 +0000</div></blockquote>It would simply be a matter of invoking the code, or similar, repetitively using utimers rather than using a public command for a one-off output.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Fri Nov 13, 2009 12:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Gabzor]]></name></author>
		<updated>2009-11-13T10:22:55-04:00</updated>

		<published>2009-11-13T10:22:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90892#p90892</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90892#p90892"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90892#p90892"><![CDATA[
Thank you for your answer.<br><br>My .xml is very simple:<br><br>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;<br>&lt;rss version="2.0"&gt;<br>&lt;channel&gt;<br>&lt;title&gt;Some title&lt;/title&gt;<br>&lt;link&gt;http://blabla&lt;/link&gt;<br>&lt;description&gt;The desctription&lt;/description&gt;<br>&lt;item&gt;<br>&lt;title&gt;avadar moonie moonchine manufactured an item (OreAmp OA-101 (L)) worth 74 PED!&lt;/title&gt;<br>&lt;pubDate&gt;Fri, 13 Nov 2009 14:17:23 +0000&lt;/pubDate&gt;<br>&lt;/item&gt;<br>&lt;item&gt;<br>&lt;title&gt;Piotr JIIIS Wojtowicz manufactured an item (Simple II Plastic Springs) worth 97 PED!&lt;/title&gt;<br>&lt;pubDate&gt;Fri, 13 Nov 2009 14:17:16 +0000&lt;/pubDate&gt;<br>&lt;/item&gt;<br>...<br><br>File handling routines to grab the information would be easy I think. But I would also need it to not copy the same line 2 times... Would need to store last title &amp; pubDate read in another file, and check from there? Don't know how to do the whole thing tho :s<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10487">Gabzor</a> — Fri Nov 13, 2009 10:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-11-13T08:36:36-04:00</updated>

		<published>2009-11-13T08:36:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90891#p90891</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90891#p90891"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90891#p90891"><![CDATA[
Not sure you will get any takers on this one.<br><br>RSS feed scripts poll a suitable site at fixed (usually configurable) intervals using a Tcl TIME bind. The smallest time interval that a TIME bind can deal with is 1 minute. An alternative approach using utimers would have to be used to accomplish polling at secondly intervals with the additional potential problem of not receiving data from one poll before the next poll is due (if a small number of seconds frequency is used). Although I appreciate that is unlikely to be the case when polling <a href="http://localhost" class="postlink">http://localhost</a>.<br><br>If I was coding something suitable, I think I would consider looking at the format of the page/file and use file handling routines to grab the information. It really depends on the complexity of (and variations in) the file, plus the information you want to grab.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Fri Nov 13, 2009 8:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Gabzor]]></name></author>
		<updated>2009-11-12T15:05:36-04:00</updated>

		<published>2009-11-12T15:05:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90882#p90882</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90882#p90882"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90882#p90882"><![CDATA[
-_-<br><br>I have a webserver, the problem is making a script that reads the rss feed every 5 seconds... I've tried a few and they all only work for 1 minute &amp; +...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10487">Gabzor</a> — Thu Nov 12, 2009 3:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-11-12T11:23:54-04:00</updated>

		<published>2009-11-12T11:23:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90880#p90880</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90880#p90880"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90880#p90880"><![CDATA[
The key to grabbing data from <a href="http://localhost" class="postlink">http://localhost</a> or <a href="http://127.0.0.1" class="postlink">http://127.0.0.1</a> is having a webserver running to serve up the http page when requested.<br><br>Did you have a webserver running on your computer when you tried?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Nov 12, 2009 11:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Gabzor]]></name></author>
		<updated>2009-11-12T10:28:50-04:00</updated>

		<published>2009-11-12T10:28:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90879#p90879</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90879#p90879"/>
		<title type="html"><![CDATA[Read RSS feed or xml file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90879#p90879"><![CDATA[
Hello everybody.<br><br>I know there are a few rss feed reader already/xml parsing file, but none worked for what I want to do.<br><br>I have an eggdrop, and I'm trying to make it parse infos from a rss feed that is on the same computer (can access it directly from <a href="http://localhost/" class="postlink">http://localhost/</a>... or can be accessed directly using system path).<br>I would like it to read the feed every 5 seconds and send new infos to a channel.<br>OR<br>Make it read directly the .xml and send new infos to a channel.<br><br>Can anyone help me?<br>Thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10487">Gabzor</a> — Thu Nov 12, 2009 10:28 am</p><hr />
]]></content>
	</entry>
	</feed>
