| View previous topic :: View next topic |
| Author |
Message |
scotteh Halfop
Joined: 29 Jan 2006 Posts: 50
|
Posted: Tue Jun 03, 2008 12:54 pm Post subject: |
|
|
| RGhost wrote: | Hi.
Can anyone help me to parse http://feeds.feedburner.com/CgIndia `?
I get "error" :
RSS Malformed Feed: Tag not closed: "<feed>"
RSS Error: Unable to parse feed properly, no data returned. "http://feeds.feedburner.com/CgIndia" |
The problem was with one of my regular expressions if you replace the line:
| Code: | | incr tmp_num [regexp -all -- "<$tag_name\(|.\[^>\]+\)>" [string range $xml_data $last_tag_end_last $tag_end_last]] |
with this line (the only change is replacing a '.' with a space)
| Code: | | incr tmp_num [regexp -all -- "<$tag_name\(| \[^>\]+\)>" [string range $xml_data $last_tag_end_last $tag_end_last]] |
|
|
| Back to top |
|
 |
pennst26 Voice
Joined: 12 May 2006 Posts: 8
|
Posted: Fri Jun 27, 2008 9:03 am Post subject: |
|
|
@Scotteh
Can you post some examples of how to filter results? My channel is being hammered with results from 30 Catgories, and I am interested in only 1 |
|
| Back to top |
|
 |
pennst26 Voice
Joined: 12 May 2006 Posts: 8
|
Posted: Thu Jul 10, 2008 1:24 pm Post subject: |
|
|
| Code: | <item><title>Spirit Of July</title>
<link>http://edited_rss.php/100072/</link>
<description>
Category: Anime
Size: 174.86 KB
Added: 2008-07-10 03:13:19
</description> |
For example the above is the rss feed but me/my channel is only interested in one single category and at the moment it is spamming the hell out of my channel with all of them.
Show me how using eval-tcl I can weed these out please =D
thank you |
|
| Back to top |
|
 |
scotteh Halfop
Joined: 29 Jan 2006 Posts: 50
|
Posted: Fri Jul 11, 2008 3:36 am Post subject: |
|
|
| pennst26 wrote: | | Code: | <item><title>Spirit Of July</title>
<link>http://edited_rss.php/100072/</link>
<description>
Category: Anime
Size: 174.86 KB
Added: 2008-07-10 03:13:19
</description> |
For example the above is the rss feed but me/my channel is only interested in one single category and at the moment it is spamming the hell out of my channel with all of them.
Show me how using eval-tcl I can weed these out please =D
thank you |
Using eval-tcl will work, but it won't be pretty. i'll work out a eval-tcl for you, send me an email.
I was planning on adding some sort of filtering based on a predetermined set of rules as quite a few people have requested it.
Currently I'm doing some rather large changes (albeit slowly), cleaning up some code and putting the configuration into its own ini like file. Also toying with the idea of making it more modular, but I'm not sure it is big enough to justify it. |
|
| Back to top |
|
 |
pennst26 Voice
Joined: 12 May 2006 Posts: 8
|
Posted: Sat Jul 12, 2008 9:28 pm Post subject: |
|
|
| e-mail sent, thank you |
|
| Back to top |
|
 |
bostik Voice
Joined: 21 Aug 2008 Posts: 1
|
Posted: Thu Aug 21, 2008 2:16 am Post subject: |
|
|
Hi,
This is great script, i just love it!
But is there a way to announce new RSS results as numbers, not in text?
For example:
<bot> sitename.com has <number> new entries.
So, it would need counting new rss results. I do handle some scripting myself, but this is out of my league.
Thanks in advance  |
|
| Back to top |
|
 |
MenzAgitat Op

Joined: 04 Jul 2006 Posts: 118 Location: France
|
Posted: Thu Aug 21, 2008 7:47 am Post subject: |
|
|
As described here, same old problem occured again today.
While trying to fetch Imaginascience's RSS feed, max CPU usage and RAM is filling until there's no ressources left.
Here is the RSS feed content that caused the problem : rss
I'm still using v0.4 because I modified it to display tinyurls and a list of available rss feeds when using !rss with no arguments, and I'm a bit lazy to do the same thing on v0.5b1 at the moment.
(If this issue has been corrected in the latest version, just tell me and I'll do an update.)
Thank you. |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Mon Aug 25, 2008 10:27 pm Post subject: |
|
|
MenzAgitat,
Can you post your modified code using tinyurl for version v0.4? I'm using version 0.4 and the displayed url is too long.
Thanks!
 |
|
| Back to top |
|
 |
MenzAgitat Op

Joined: 04 Jul 2006 Posts: 118 Location: France
|
Posted: Tue Aug 26, 2008 7:25 am Post subject: |
|
|
@holycrap:
Be warned of a few things before modifying anything:
- This trick may not be clean but it is a trick, it had been made in 5mn and has not been intended to be made public.
- My modification uses an old version of TkTiny by Tomekk (v0.4 I think). Latest version is 0.5.
- It has only been tested on RSS Syndication v0.4 but you can probably adapt it to v0.5b1 without too much pain.
- I give it to you "as is" and I'm not providing support for it.
- It works for me.
If you agree with the preceding terms, let's go.
You must first add this proc in the script:
| Code: | proc grab_data { url } {
set get_url_timeout "10"
set uagent "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3"
set url [string map -nocase {
"&" "&"
} $url]
set tiny_query "http://tinyurl.com/create.php?url=${url}"
set tiny_token [http::config -useragent $uagent]
set tiny_token [http::geturl $tiny_query -timeout [expr $get_url_timeout * 1000]]
set html_data [http::data $tiny_token]
set all_n [split $html_data \n]
set tiny_link ""
foreach tiny_lines $all_n {
if {[regexp -all -nocase "name\=tinyurl" $tiny_lines]} {
regsub -all -nocase "<input type=hidden name=tinyurl value=\"" $tiny_lines "" tiny_link
regsub -all -nocase "\">" $tiny_link "" tiny_link
}
}
if {$tiny_link != "0" && $tiny_link != ""} {
return $tiny_link
} {
return "\00307(there's a problem with tinyurl.com)\003 \00314${url}\003"
}
} |
then find the line: | Code: | | set tmp [[namespace current]::xml_list_flatten $tmp] | and add just after it: | Code: | if {([info exists feed(charset)]) && (([string last "title" $cookie] == 25) || ([string last "title" $cookie] == 19))} { set tmp [encoding convertfrom $feed(charset) [encoding convertfrom $feed(charset) $tmp]] }
if {([string last "link" $cookie] == 25) || ([string last "link" $cookie] == 19)} { set tmp [grab_data [lindex $tmp]] }
|
|
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Wed Aug 27, 2008 2:20 am Post subject: |
|
|
It doesn't work, I still get the long url. Do I have to download the tinyurl.tcl and load it separately? I'm using v0.4
 |
|
| Back to top |
|
 |
Straasha Voice
Joined: 27 Aug 2008 Posts: 3
|
Posted: Wed Aug 27, 2008 3:30 am Post subject: |
|
|
Hi,
This script working fine.
Can you tell me, how I could change color ?
thx in advance. |
|
| Back to top |
|
 |
Straasha Voice
Joined: 27 Aug 2008 Posts: 3
|
Posted: Wed Aug 27, 2008 4:09 am Post subject: |
|
|
| Straasha wrote: | Hi,
This script working fine.
Can you tell me, how I could change color ?
thx in advance. |
i have found the command tcl /003 and it's ok.
Now i have other problem : the option "trigger-type" 0:2 workinf fine but with notice (1:3) he don't works....
Can you help me please ?
Thx. |
|
| Back to top |
|
 |
Straasha Voice
Joined: 27 Aug 2008 Posts: 3
|
Posted: Wed Aug 27, 2008 5:53 am Post subject: |
|
|
It's ok now:
I have change line to : putserv "NOTICE $nick :$line" |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Wed Aug 27, 2008 10:17 pm Post subject: |
|
|
| Quote: | It's ok now:
I have change line to : putserv "NOTICE $nick :$line" |
You got it to work with tinyUrl support? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Aug 27, 2008 10:58 pm Post subject: |
|
|
Just a side note: It's quite clear why the author of this script chose to leave this part out.
| Code: | <form>
<!--
///// DON'T SCREEN-SCRAPE, PLEASE CONTACT US TO FIND OUT HOW TO USE OUR API
<input type=hidden name=tinyurl value="http://tinyurl.com/63qeuv">
-->
</form> |
| Code: | proc tinyurl {url} {
# tinyurl given, let's expand to original url
if {[regexp -nocase {tinyurl.com/(.+?)$} $url - url]} {
set token [http::geturl "http://tinyurl.com/$url" -timeout 3000]
upvar #0 $token state
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} { return $value }
}
} else {
# regular url given, let's tiny size it!
set token [http::geturl "http://tinyurl.com/create.php?[http::formatQuery url $url]" -timeout 3000]
upvar #0 $token state
if {[regexp {<blockquote><b>http://(tinyurl.com/.+?)</b>} $state(body) - value]} { return $value }
}
# something went wrong return original url
return $url
} |
Something like that is much simpler. If it finds the location you get a tinyurl, if it can't you get your regular url. Simplicity at it's finest. Then maybe add that procedure and change something to look like this. | Code: | | set tmp [tinyurl [[namespace current]::xml_list_flatten $tmp]] |
Assuming that is the portion that holds the url/link.....
PS. The tinyurl example above has dual functionality if you read the comments. It also assumes you have done the 'package require http' part to satisfy use of http commands.
Since it uses formatquery any url combination will work with this tinyurl approach. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|