| View previous topic :: View next topic |
| Author |
Message |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Wed Dec 26, 2007 10:23 am Post subject: grouphug script by perplexa not working |
|
|
I can see that the url has changed since the script was released - http://grouphug.us to http://beta.grouphug.us currently. I.ve reflected this in the script but still no confessions are displayed but this message:
'[Error] Could not find a confession.'
My coding limit is simple bodging so can someone else suggest or provide a fix for this?
tia
ps I should add fsck is installed. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Dec 26, 2007 6:46 pm Post subject: |
|
|
| Code: | regexp -nocase -- {<h4>(\d+)} $data -> id;
regexp -nocase -- {<h4><a\shref=\"/confessions/(\d+)\">} $data -> id;
regexp -nocase -- {<p>(.*?)</p>} $data -> confession;
regsub -all {((\n|\r|\s|\t)|(<br\s\/>))+} $confession " " confession;
regsub -all -- {<.*?>(.*?)</.*?>} $confession {\1} confession;
set confession [string trim $confession];
return "\[Confession $id\] [expr {($confession=="")?"No such confession id.":"$confession"}]"; |
Here is your scraper along with the return of results. What you will need to do is become familiar with regexp and regsub (regexp takes, pulls data from an expression, your scraper; regsub substitutes, replaces data in an expression, cleans up the scrape). The html template (aka, the tags which delineate the text desired) has changed and you must update your template scraper (aka, the regexp's) to accomodate the change. It would be quite easy for me to solve for you if I wasn't in such a hurry.. Hopefully someone can brighten your day before I get back from errands and I won't need to. Just posted to let you know the area you should focus your interest on.  |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Wed Dec 26, 2007 8:54 pm Post subject: |
|
|
Thank you speechles, I think I'll hold on for a while and see what happens here first of all.  |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Dec 29, 2007 11:04 am Post subject: |
|
|
Change from: | Code: | regexp -nocase -- {<h4>(\d+)} $data -> id;
regexp -nocase -- {<h4><a\shref=\"/confessions/(\d+)\">} $data -> id; |
Change to: | Code: | regexp -nocase -- {<h1 class="title">(\d+)} $date -> id;
regexp -nocase -- {<h2 class="title">.*?<a\shref="/confessions/(\d+)">} $data -> id; |
Solved, I found time.
Prior to tcl version 8.3.1 the double-quote was not allowed inside curly braces, which was a bug. Ever since tcl 8.3.1 fixed this, Perplexa's use of escapes to protect double-quotes inside curly braces isn't required anymore. I'm just letting you know this to help you better understand regexp. |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Sat Dec 29, 2007 7:03 pm Post subject: |
|
|
Thanks for evaluating the script and replying but I have no idea what I should do to correct the code. I'm not even a tcl novice. The correction you made doesn't appear to be a simple copy & paste swap so I don't know what to do with it. I don't wish to appear ungrateful and appreciate that you want to encourage posters to learn tcl but I really can't commit to studying it atm for one lapsed script. If you could make it a bit easier to grasp that would be great but it might turn into a saga . I contacted perplexa and he says he is waiting for the grouphug site to complete the upgrade before he updates. Thanks again. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Dec 29, 2007 7:08 pm Post subject: |
|
|
| shadrach wrote: | Thanks for evaluating the script and replying but I have no idea what I should do to correct the code. I'm not even a tcl novice. The correction you made doesn't appear to be a simple copy & paste swap so I don't know what to do with it. I don't wish to appear ungrateful and appreciate that you want to encourage posters to learn tcl but I really can't commit to studying it atm for one lapsed script. If you could make it a bit easier to grasp that would be great but it might turn into a saga . I contacted perplexa and he says he is waiting for the grouphug site to complete the upgrade before he updates. Thanks again. |
What is so difficult? Just take each line individually. Load up the whatever.tcl in wordpad. Use replace in the menus (replacing each line individually, because wordpad won't let you do multiple lines at once). The two lines are right next to each other. This is a simple copy & paste swap. Resave the document as TXT type in wordpad, and name it whatever.tcl it was when you opened it. Your making things out harder than they seem.
and about the contact perplexa part..You should have done that before making a topic on the subject (I was under the mistaken impression you already had asked and gotten no reply). This topic should be closed if a mod happens to peek in. |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Sat Dec 29, 2007 8:40 pm Post subject: |
|
|
Speechles, we were both wrong and right. The grouphug script in the tcl archive at this site is different to the one i was using. I probably got it at perplexa's site, http://perplexa.ugug.org/. The lines you highlighted are absent in the more recent script I had. I wasn't aware there was difference, sorry. I just downloaded the older one from the archive here and performed the search and replace successfully -i'm not so stupid . So I've uploaded this revised script to my eggdrop but it still doesn't work. I think the url paths are wrong still and i'm currently messing around with this to see if i can accidentally get it to work. grouphug uses google to search now i think. Yes, I contacted perplexa earlier in the week via his shoutbox but he hasn't posted there since june so I wasn't hopeful of a response. |
|
| Back to top |
|
 |
|