T O P I C R E V I E W |
hoodric |
Posted - 04 Nov 2007 : 09:03:07 I'm trying to write a script that will take a movies position on the IMDB Top 250 list if the movie is on it. This is my first attempt at writing a script though and I can't seem to get it to work.
I've used the start of the IMDB (Fastest) script to reset all the variables and get the directlink from CUSTOM8. I've then written my own bit of script to try and read the Top 250 information if the page has it but it's not working. Any ideas where i'm going wrong?
Here is the part I wrote -
--IMDBTOP250--------------------------------------------------------------------------------
#CUSTOM1#
#STARTREADWEB# #FIND#=<a href="/chart/top?#48##ONERROR#=*OK* #IF# #48#==#00# #GOTO#=ENDTAKECUSTOM1 #ENDIF# #FIND#=Top 250: #11##ONERROR#=*STOP* #FIND#=</a>#12##ONERROR#=*STOP* #TAKEWORD#=#20#,#11#,#12# #CUSTOM1VALUE#=#20#
:ENDTAKECUSTOM1 #RESTOREWEB# #RESTOREMAIN#
#ENDCUSTOM1# |
4 L A T E S T R E P L I E S (Newest First) |
Alessio Viti |
Posted - 07 Nov 2007 : 11:18:39 Thank you very much Hoodric!!
I will update the script in few hours!
Alessio |
hoodric |
Posted - 07 Nov 2007 : 11:08:42 Maybe I spoke a little too soon. It didn't quite work how I wanted it to. The script imported the data fine, but XMM was unable to sort it into numerical order because of the "Top 250: #" tag before each number.
I added the following to the #CUSTOM1# and #DELETETAGS# sections to remove the words and leave me with just the number.
#CUSTOM1# #STARTDELETETAGS# #TRIM#
#DELETETAGS# #DELETEWORD#=Top #DELETEWORD#=250: #DELETEWORD#=#
This removed the "Top 250: #" text but XMM was still unable to sort the data into numerical order due to the mixture of 1, 2 and 3 digit numbers.
I added a couple of #PUT# and #IF# statements to pad the numbers out to 3 digits. XMM can now sort the data numerically based on IMDB top 250 position.
Here is the altered script for anyone who wants it.
--IMDBTOP250-------------------------------------------------------------------------------- #CUSTOM1#
#PUT#=100#49# #PUT#=10#50# #RESTOREMAIN# #STARTREADWEB# #FINDLINE#=/chart/top?#15##ONERROR#=*OK* #IF# #15#==#00# #GOTO#=ENDTAKECUSTOM1250 #ENDIF# #FIND#=>Top 250: #11##ONERROR#=*STOP* #FIND#=</a>#12##ONERROR#=*STOP* #TAKEWORD#=#13#,#11#,#12# #STARTDELETETAGS# #TRIM# #IF# #13#<<#50# #STRING#=#04#=00#13# #TAKECUSTOM1#=#04# #GOTO#=ENDTAKECUSTOM1250 #ENDIF# #IF# #13#<<#49# #STRING#=#04#=0#13# #TAKECUSTOM1#=#04# #GOTO#=ENDTAKECUSTOM1250 #ENDIF#
#TAKECUSTOM1#=#13#
:ENDTAKECUSTOM1250
#ENDCUSTOM1#
--DELETETAGS-------------------------------------------------------------------------------- #DELETETAGS# #DELETEWORD#=Top #DELETEWORD#=250: #DELETEWORD#=# |
hoodric |
Posted - 05 Nov 2007 : 18:22:30 Thanks for the help. It works perfectly. |
Alessio Viti |
Posted - 05 Nov 2007 : 11:38:23 Hi ,
You have to use the FINDLINE and not the FINF for the "<a href="/chart/top?#48##ONERROR#=*OK*"
And you have to use this (I will upload the modified script in few minutes)
--IMDBTOP250-------------------------------------------------------------------------------- #CUSTOM1#
#RESTOREMAIN# #STARTREADWEB# #FINDLINE#=/chart/top?#15##ONERROR#=*OK* #IF# #15#==#00# #GOTO#=ENDTAKECUSTOM1250 #ENDIF# #FIND#=>Top 250: #11##ONERROR#=*STOP* #FIND#=</a>#12##ONERROR#=*STOP* #TAKEWORD#=#13#,#11#,#12# #TAKECUSTOM1#=#13#
:ENDTAKECUSTOM1250
#ENDCUSTOM1# |