RefreshCapcha

Author Topic: Script problem - next records  (Read 8441 times)

EagleXK

  • Guest
Script problem - next records
« on: February 17, 2010, 09:20:24 am »
Greetings!
I tried to make my own script for russian torrent index site RUTOR, but I have problem - I can get only first record, aloop is not working for some reason. I'm asking to look at my code and tell me, what's wrong with them. Thanks in advance!

Quote
[script]
name=RUTOR
author=EagleXK
enabled=1
home=http://rutor.org
main=http://rutor.org/search/%SEARCH%
apps=http://rutor.org/search/0/9/000/0/%SEARCH%
games=http://rutor.org/search/0/8/000/0/%SEARCH%
audio=http://rutor.org/search/0/2/000/0/%SEARCH%
video=http://rutor.org/search/0/1/000/0/%SEARCH%

Code: [Select]
x=h(x,d,<a class="downgif")
z=i(x,d,</table>)
d=c(d,x,z)
r=split(d,</tr)
start
q=split(r,/td>,1)
t=array(q,0)
x=p(20)
7=x(t,x,","><,http://rutor.org)
x=i(x,t,"/torrent/)
3=x(t,x,",">,http://rutor.org)
1=x(t,x,>,<)
t=array(q,2)
x=p(1)
x=i(x,t,>)
2=x(t,x,>,<)
t=array(q,3)
x=p(1)
x=i(x,t,arrowup.gif)
5=x(t,x,;,<)
x=i(x,t,arrowdown.gif)
6=x(t,x,;,<)
aloop

BTW: I can't check if it is working well with categories because I have a free edition, but I suppose it will do.
« Last Edit: February 17, 2010, 09:29:31 am by EagleXK »

Offline CuF

  • Sr. Member
  • ****
  • Posts: 331
  • Karma: +40/-0
    • View Profile
Re: Script problem - next records
« Reply #1 on: February 19, 2010, 03:46:24 pm »
I've had that happen to me before too.  It makes you crazy until you see it.

What happened was you cut too much off the top of the data in the first line: x=h(x,d,<a class="downgif")

There is an additional <td>(torrent date)</td> just before that.

As a result, the first hit's Q array has 4 lines, but all results that follow have 5.
So when consecutive hits were run through the script no data was found where it was looking because every t=array(q,N) is off by one.

I also made a few other minor changes.
I added 'vacuum' which just makes it easier to debug.
I also changed what you were using as a pointer.  Z is better because it gets reset to 0 automatically when you change the t=array().

Did any of that make sense?  Working script is attached.

EagleXK

  • Guest
Re: Script problem - next records
« Reply #2 on: February 19, 2010, 04:15:48 pm »
Oh! Many thanks! [beerchug] Looks like I'll need more practice to make correct scripts [smile]

Offline CuF

  • Sr. Member
  • ****
  • Posts: 331
  • Karma: +40/-0
    • View Profile
Re: Script problem - next records
« Reply #3 on: February 20, 2010, 03:30:51 pm »
I takes a bit of practice.
When I first started I got scripts working by luck more than anything else
I  had no idea what I was doing.  ;)