Jump to content
UBot Underground

How do I use $eval?


Recommended Posts

I am scraping a math problem, this worked just fine a few weeks back, today it isnt working at all.

 

I can scrap the inner text, it is a simple but random math problem such as 4 - 2 =

 

 

 
set(#math, $scrape attribute($element offset(<tagname="strong">, 26), "innertext"), "Global")
type text(<name="captcha_math">, $eval(#math), "Standard")
 
 
type text does not seem to work, $eval never seems to do anything. 
 
Has something changed? Am I doing this wrong? 
 

 

Link to post
Share on other sites

You can't $eval a string (text) expression, it needs to be math between numerals.

 

You'll have to extract the separate values...

 

Or even easier, navigate to Google, paste it there a a search string and scrape the result:

 

http://www.google.com/search?q=4+-+2+%3D

Link to post
Share on other sites

Hi,

 

If the value of #math is 4 - 2 =

Try this updated code:

 

type text(<name="captcha_math">, $eval($trim($replace(#math, "=", $nothing))), "Standard")

 

 

The code should remove the "=" and any extra spaces.

 

Kevin

Link to post
Share on other sites

Again


set(#math, "5 - 3 =", "Global")
add list to list(%math, $list from text(#math, "-"), "Delete", "Global")
set(#m1, $trim($list item(%math, 0)), "Global")
set(#m2, $trim($replace($list item(%math, 1), "=", $nothing)), "Global")
set(#math, $subtract(#m1, #m2), "Global")
Link to post
Share on other sites

OP, I hope you don't mind me sorta hijacking your thread, but I'm having problems with eval and I don't want to clutter the forum with a new thread.  

 

eval seems to never work.  What gives?  It's weird, though, because on the bot I'm currently working on it will work when I go through the nodes manually and right click then select run node.  But when I click play to run it it's just giving me nothing for a simple math expression.

 

I have a variable and I want to have it loop five times the value of that variable.  simple enough:

 

set(#var, "5", "Global")

set(#loop, $eval($multiply(#var, 5)), "Global")

 

Am I not able to use a variable inside an eval expression?  But I swear it's working when I slowly go through and right click to run the nodes....

Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...