| View previous topic :: View next topic |
| Author |
Message |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Dec 12, 2007 2:04 am Post subject: |
|
|
The last bit of your regexp doesn't take into account the carriage returns in the page:
You have:
</table></td>
The webpage has:
You probably don't need the </td> anyway, as the html is very simple, so this bit should get your data:
| Code: |
regexp {table width="100%">(.*?)</table>} $html match data
|
Then you'll have to clean things up. One thing to note, putcmdlog won't show you data if there's carriage returns, so you can either strip them out first with regsub, or use a foreach loop:
| Code: |
foreach line [split $data \n] {
putcmdlog "line '$line'"
}
|
Once you have your block of data, this should clean up the data and give you just the movie titles:
| Code: |
regsub -all {<td width="43%" valign="top">(.*?)</td>} $data {\1} outputvar
foreach line [split $outputvar \n] {
set line [string trim $line]
if {$line != ""} {
putcmdlog "line '$line'"
}
}
|
One peculiarity I've noticed when using regsub's substitutions (like \& \0 \1 etc) is it inserts bold codes and IIIIIII's into the output.. string trim seems to work to get rid of them in otherwise empty lines. You'll probably see it in the raw output. |
|
| Back to top |
|
 |
LivingSouL Voice

Joined: 04 May 2007 Posts: 15 Location: Davao
|
Posted: Wed Dec 12, 2007 2:34 am Post subject: |
|
|
argh....
Sorry for my fault... silly me.. I forgot to comment the line that redirects back to the 1st site... that explains why it detects no data... sorry... its ok now.. thank you very much for the help.. I appreciate it..  _________________ http://www.chatx.net |
|
| Back to top |
|
 |
LivingSouL Voice

Joined: 04 May 2007 Posts: 15 Location: Davao
|
Posted: Thu Mar 20, 2008 12:43 pm Post subject: Help |
|
|
I accidentally deleted your old movies script that I was using on my channel. and now, I'm confused on why it is displaying these:
| Code: |
[00:40] <LivingSouL> .movies nccc
[00:40] <Davao> Movies Now Playing at NCCC Cinemas:
[00:40] <Davao> 1) {
[00:40] <Davao> 2) } {ONE MISSED CALL} {
[00:40] <Davao> 3) } {10,000 BC} {
[00:40] <Davao> 4) } {MY BIG LOVE} {
[00:40] <Davao> 5) } {DRAGON WAR}
[00:40] <Davao> [End of Movies Now Playing at NCCC Cinemas]
|
Here's the code I've partially modified:
| Code: |
if {$command == "" || $command == "NCCC" || $command == "nccc"} {
set movieurl "http://www.nccc.com.ph/cinema/"
set regexm {<td valign='top'>(.*?)</td></tr></table>}
set moviehead "Movies Now Playing at NCCC Cinemas"
}
|
_________________ http://www.chatx.net
Last edited by LivingSouL on Tue Apr 01, 2008 10:16 pm; edited 1 time in total |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Mar 20, 2008 3:28 pm Post subject: Re: Help |
|
|
| LivingSouL wrote: | | Code: | set movienames [regexp -all -inline {<div class='h1'>(.*?)</div>} $moviedata]
... snipped irrelevant sections...
regsub -all {\n} $movienames "\n" movienames
... snipped irrelevant sections...
foreach name [split $movienames \n] { |
|
This is your problem, your removing all newline elements from that movienames list (using regsub, on a list?!). Then a few lines down, you attempt to split it (it's already a list, why do you split it?!) using newline (after you already removed newline with that silly regsub). Do you see why this can't be done silly? Instead, use this: | Code: | | foreach name $movienames { |
movienames doesn't need to be split, it's already an inline list built by the regexp. Splitting it again in effect adds those curly bracings your seeing. Split protects existing special characters by escaping them. So by splitting twice, you are asking the interpreter to protect those curly braces for display, rather than use them to encapsulate list elements and fields. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Thu Mar 20, 2008 9:00 pm Post subject: |
|
|
1) You posted in the wrong thread. The script you broke is the Movietome script, not the IMDB-now playing script
2) YOU broke it by modifying it. My copy works just fine, I just checked.
You broke it, you get to fix it  |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Sun Apr 27, 2008 4:36 pm Post subject: |
|
|
| Returning 'No movie data found.' currently. |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sun Apr 27, 2008 4:52 pm Post subject: |
|
|
| shadrach wrote: | | Returning 'No movie data found.' currently. |
Mine works fine, no clue what you meant there. |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Sun Apr 27, 2008 5:49 pm Post subject: |
|
|
| Whereas previously the script would return the intended info about movie charts and pending releases to the channel, it now returns a 'No movie data found.' message in privmsg. I thought imdb.com might have changed something but perhaps not if your test is successful. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Apr 28, 2008 9:27 pm Post subject: |
|
|
| shadrach wrote: | | Returning 'No movie data found.' currently. |
Did you perchance edit the script with a windoze editor? Non conforming EOL (hidden) characters are added and in most cases cause unexpected results in Tcl scripts within a Unix environment. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Tue Apr 29, 2008 9:06 am Post subject: |
|
|
| Alchera wrote: | | shadrach wrote: | | Returning 'No movie data found.' currently. |
Did you perchance edit the script with a windoze editor? Non conforming EOL (hidden) characters are added and in most cases cause unexpected results in Tcl scripts within a Unix environment. |
No. The script has been functioning fine for several weeks since it was installed. The change in behaviour seems quite spontaneous. Another thing, although pertaining to a different script this concerns imdb.com again, the imdb.tcl in the archive ((c) 2003 by B0unTy, revised last by by OV2 21.09.2007) has stopped returning Cert and Plot info. - not plot keywords. This occurred around the same time as the 'Now Playing' script problem arose. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Fri May 02, 2008 5:23 pm Post subject: |
|
|
Yes that's the version I use. The default info is returned. I added Cert and Plot cookies which were returning the info from imdb.com until last week but now those lines are blank. All other cookies work.
The Now Playing script on the other hand returns nothing in channel and in privmsg just the No movie data found. message. |
|
| Back to top |
|
 |
StoN3d Voice
Joined: 04 May 2008 Posts: 1
|
Posted: Sun May 04, 2008 1:46 pm Post subject: |
|
|
I am having the SAME EXACT problems with the IMDB and NOW Playing scripts and iI have not touched a thing.
They were working now all i get is Data not found in a pm and it will not post the Plot info. |
|
| Back to top |
|
 |
OV2 Voice
Joined: 21 Jan 2006 Posts: 35
|
Posted: Mon May 19, 2008 12:51 pm Post subject: |
|
|
shadrach: I've fixed the broken cookies
If you notice something like that you can simply drop me a mail and I'll look into it. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon May 19, 2008 5:06 pm Post subject: |
|
|
| As well as reply in the right thread, this one is for the NOW PLAYING script I wrote, not the Imdb script OV2 wrote =) |
|
| Back to top |
|
 |
|