OK, let's have a look again, Pb's 2 and 3 should be pretty easy, I thought, compared to 1...
widilye wrote:Pb's_1 case problem I am using script:
Code: Select all
TAG POS=1 TYPE=I ATTR=CLASS:image-*&&TITLE:&&DATA-ORIGINAL-TITLE:* EXTRACT=HTM
SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var y,z; y=s.split('-title=\"'); z=y[1].split('\"'); z[0];")
And successfully displayed at prompt:
OK, this one is settled...
widilye wrote:For Pb's_2 case problem I am using script:
Code: Select all
TAG POS=1 TYPE=IMG ATTR=ID:shop-reputation-badge* EXTRACT=HREF
SET !EXTRACT EVAL("var s = '{{!EXTRACT}}'; var s = s.split('https://imagerouter.tokopedia.com/img/nocache/repsys/')[1]; s = s.split('.gif')[0]; s;")
And successfully displayed at prompt:
But some results from other missing code scripts are not displayed. If I do not use 'split ()'. Some of the missing code's results can be displayed again.
Yep, this one works "partially" I understand...
OK..., a few Remarks...:
I guess you started from an Example which wasn't from me (I never apply my 'EVAL()' Statements directly to '!EXTRACT' itself, I consider it "Bad Practice" if you need to debug/modify your Script or (later) want to include some (Debug) Logging or Reliability Checks, and makes your own Code more difficult to follow/understand for other Users and is usually used by "semi" Advanced Users to impress a bit other Users...!), notice that in "my" 'EVAL()' for Pb_1, I use "x,y,z" Temp Vars for Temp Calculations or String Manipulations and finish on "z" for the final Result, while you reuse the same "s" Var for all your Temp Statements..., which works indeed, but it's easier to use Temp Vars with different Names like I do to be able to debug each part separately...
Hum, and same Remark about applying your 'EVAL()' directly to '!EXTRACT', you can do it once you are a bit Advanced and know exactly what you are doing, or after you know your Code is working if you want to optimize and shorten it, but that's not a "best Practice" if you are a Beginner and don't sound like you are even able to debug your Script by yourself...
Second Remark is that your first 'split()' (on "
https://imagerouter.tokopedia.com/img/nocache/repsys/") is a bit of a "stiff Overkill", ah-ah...! If this part is always present, then you normally would use 'replace()' for that, even if it will indeed work with 'split()' as well, but I would rather use the 'split()' on the "/" in the URL and you are then interested by the Data after the 6th '/', and same thing with the 2nd 'split()', if you do it on the Dot only, your Statement will still work if some Image has a '.png' instead of '.gif' Extension like:
Code: Select all
SET EXTRACT NULL
TAG POS=1 TYPE=IMG ATTR=ID:shop-reputation-badge* EXTRACT=HREF
'SET !EXTRACT EVAL("var s = '{{!EXTRACT}}'; var s = s.split('https://imagerouter.tokopedia.com/img/nocache/repsys/')[1]; s = s.split('.gif')[0]; s;")
SET Rep_Badge EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('/'); y=x[5].split('.'); z=y[0]; z;")
PROMPT EXTRACT:<BR>{{!EXTRACT}}<BR><BR>Rep_Badge:<SP>_{{Rep_Badge}}_
=> I expect it to work directly if I didn't make any Mistake, but in case anything goes "wrong", you can easily debug the 'EVAL()' Statement by changing the last "z" for the Return Value to "y" or "x" to check if those parts work correctly...
widilye wrote:In case study Pb's_3 I can not solve the problem
Code: Select all
TAG POS=1 TYPE=SPAN ATTR=CLASS:bold&&ITEMPROP:price EXTRACT=TXT
SET !EXTRACT EVAL( )
Okay here's the whole script code and in case Pb's_3 is not in the script code below because I can not solve it yet.
Code: Select all
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
'The first data to be inputted is the 1st
SET !LOOP 1
URL GOTO=https://www.tokopedia.com/importirshop/munafie-korset-slimming-pants-pakaian-dalam
SET !VAR0 EVAL("Math.floor(Math.random()*5 + 1);")
'Reputation Shop | 2- 'EXTRACT = HREF' (or '= HTM') + 'EVAL ()' with 'split ()'. (Case Pb's_2)
TAG POS=1 TYPE=IMG ATTR=ID:shop-reputation-badge* EXTRACT=HREF
SET !EXTRACT EVAL("var s = '{{!EXTRACT}}'; var s = s.split('https://imagerouter.tokopedia.com/img/nocache/repsys/')[1]; s = s.split('.gif')[0]; s;")
WAIT SECONDS={{!VAR0}}
'Reputation Point | (case Pb's_2)
TAG POS=1 TYPE=IMG ATTR=ID:shop-reputation-badge-*&&SRC:*&&DATA-ORIGINAL-TITLE:* EXTRACT=HTM
SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var y,z; y=s.split('-title=\"'); z=y[1].split('\"'); z[0];")
WAIT SECONDS={{!VAR0}}
'Store Status | 1- 'EXTRACT = HTM' + 'EVAL ()' with 'split ()' or 'match ()'. (Case Pb's_1)
TAG POS=1 TYPE=I ATTR=CLASS:image-*&&TITLE:&&DATA-ORIGINAL-TITLE:* EXTRACT=HTM
SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var y,z; y=s.split('-title=\"'); z=y[1].split('\"'); z[0];")
WAIT SECONDS={{!VAR0}}
'Selling Price 10% increase of purchase price | 3- 'EXTRACT = TXT' + 'EVAL ()'. (Case Pb's_3) <--- I can not solve it yet
TAG POS=1 TYPE=SPAN ATTR=CLASS:bold&&ITEMPROP:price EXTRACT=TXT
SET !EXTRACT EVAL( )
WAIT SECONDS={{!VAR0}}
'Seller
TAG POS=1 TYPE=A ATTR=ID:shop-name-info&&HREF:*&&CLASS:*&&DATA-TOGGLE:*&&ITEMPROP:*&&DATA-ORIGINAL-TITLE:* EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Store Locations
TAG POS=1 TYPE=SPAN ATTR=ITEMPROP:addressLocality EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Name of goods
TAG POS=1 TYPE=H1 ATTR=CLASS:product-title<SP>green* EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Address Buy
ATTR=HREF:https://www.tokopedia.com/*/*&&ITEMPROP:name&&CONTENT:* EXTRACT=HREF
WAIT SECONDS={{!VAR0}}
'Pre order
TAG POS=1 TYPE=DIV ATTR=CLASS:po_info_pict* EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Purchase price
TAG POS=1 TYPE=SPAN ATTR=CLASS:bold&&ITEMPROP:price EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.replace(/\\./g, ',');")
WAIT SECONDS={{!VAR0}}
'Quality Value
TAG POS=1 TYPE=DIV ATTR=CLASS:clear-b<SP>rate-accuracy<SP>reviewsummary-loop* EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Value Accuracy
TAG POS=2 TYPE=DIV ATTR=CLASS:clear-b<SP>rate-accuracy<SP>reviewsummary-loop* EXTRACT=TXT
WAIT SECONDS={{!VAR0}}
'Replace' # EANF # 'Values with' EANF_String 'defined at beginning of Script
SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var eanf='{{EANF_String}}'; var z; z=s.split('#EANF#').join(eanf); z;")
WAIT SECONDS={{!VAR0}}
'Save Data.'
SAVEAS TYPE=EXTRACT FOLDER=D:\DROPSHIP\ FILE=toped_list-tes.csv
PAUSE
I am still dodging the script code issues of Pb's_1, Pb's_2 and Pb's_3 and still looking for the best solution for my script problem in learning iMacros, and I'm totally ignorant of javascript, vb, and other coding. Please help me to complete my case study.
OK, I don't have much time now for Pb_3, but see if the "Recommendations" I gave for Pb_2 already help you to find the Solution by yourself or at least progress a bit...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...