Jump to content
UBot Underground

$Page Scrape Without Element Or Text On Right Side


Recommended Posts

Hello,

 

I have a website that return a plain txt example:

RESULT|03AJzQf7NGfeGGTfVYRW5FD

I need the text after RESULT| to set as a variable

03AJzQf7NGfeGGTfVYRW5FD

tried:

set(#asd,$page scrape("RESULT|",""),"Global")
set(#asd,$page scrape("RESULT|","*"),"Global")
set(#asd,$page scrape("RESULT|","{*}"),"Global")

nothing worked ..

 

any idea ?

 

Regards

Link to post
Share on other sites

ok... I managed to do this with javascript by injecting at the end a span.

function appendHtml(el, str) {
	  var div = document.createElement('div');
	  div.innerHTML = str;
	  while (div.children.length > 0) {
	    el.appendChild(div.children[0]);
	  }
	}
	var html = '<span>Finish</span>';
	appendHtml(document.body, html);

Regards

Link to post
Share on other sites

Like Marani said regex is a good choice, I made the code for it and also for a second way as well which just uses a list with the pipe | as the delimiter. In this case regex is probably better because its less code but in the future if you run into this same problem with another thing and don't know regex then you can easily just use the second method instead:

set(#text,"RESULT|03AJzQf7NGfeGGTfVYRW5FD","Global")
comment("First way")
set(#result,$find regular expression(#text,"(?<=\\|).*"),"Global")
comment("Second way")
clear list(%result)
add list to list(%result,$list from text(#text,"|"),"Delete","Global")
set(#result2,$list item(%result,1),"Global")
Link to post
Share on other sites

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...