This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

grouphug script by perplexa not working

Support & discussion of released scripts, and announcements of new releases.
Post Reply
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

grouphug script by perplexa not working

Post by shadrach »

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.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

  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. :wink:
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

Thank you speechles, I think I'll hold on for a while and see what happens here first of all. :P
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Change from:

Code: Select all

  regexp -nocase -- {<h4>(\d+)} $data -> id;
  regexp -nocase -- {<h4><a\shref=\"/confessions/(\d+)\">} $data -> id;
Change to:

Code: Select all

  regexp -nocase -- {<h1 class="title">(\d+)} $date -> id;
  regexp -nocase -- {<h2 class="title">.*?<a\shref="/confessions/(\d+)">} $data -> id;
Solved, I found time. 8)
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.
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

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 :lol: . I contacted perplexa and he says he is waiting for the grouphug site to complete the upgrade before he updates. Thanks again.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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 :lol: . 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. :wink:

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.
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

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 :wink: . 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.
Post Reply