Jump to content
UBot Underground

Newbie Needs Help With Scraping


Recommended Posts

Hello,

I just bought Ubot for several days. 

I've watched some videos about scraping with Ubot but I'm still trying to figure it out.

I think Ubot is awesome for scraping multiple similar results on a page.

 

Now I want to scrape just one element, e.g. the person's name on this website http://www.fakenamegenerator.com/.

The element is inside an <h3>. It will scrape every innertexts of H3 elements on a page if I set the element to scrape. <tagname="h3">, which I don't want.

 

Is there a way to slect element to scrape with ubot by pinpointing using selectors like this in Winautomation: html > body > div:eq(1) > div > div > div:eq(0) > div > div:eq(2) > div:eq(1) > div:eq(1) > div > div:eq(0) > h3

 

Maybe I'm used to using Winautomation (just right click and the element is pinpointed), so I find it difficult with Ubot.

 

Sorry if my explanation is not clear.

Thanks for the help.

 

 

 

Link to post
Share on other sites

Although Pash's answer is correct and easier,just my guess as to win automation

 

From looking at the snippet of code you get from WinAutomation,I guess they use CSS Paths for scraping,which you can also use with Ubot,check out my post on this for instructions

 

http://network.ubotstudio.com/forum/index.php/topic/18609-reddit-upvote-using-javascript/?p=115851

 

snippet for the name would be 

 

set(#name,$eval("document.querySelector(\"#details > div.content > div.info > div > div.address > h3\").textContent"),"Global")

 

might look a bit complicated Using Eval but it really is not

 

Or what is easier is using my CSS Selector Plugin

 

http://network.ubotstudio.com/forum/index.php/topic/18575-css3-selector-for-ubot-my-first-pluginxpath-alternative/

 

script with that plugin would be

 

set(#name,$plugin function("CSSPluging.dll", "$CSS Selector", $document text, "#details > div.content > div.info > div > div.address > h3", "TextContent"),"Global")

Link to post
Share on other sites

 

 use "element offset" or "regex"

 

try

set(#Name,$scrape attribute($element offset(<tagname="h3">,0),"innertext"),"Global")

Thank you. I tried element offset and was successful at getting a specific element of the page, though it takes a bit of guessing.

Although Pash's answer is correct and easier,just my guess as to win automation

 

From looking at the snippet of code you get from WinAutomation,I guess they use CSS Paths for scraping,which you can also use with Ubot,check out my post on this for instructions

 

http://network.ubotstudio.com/forum/index.php/topic/18609-reddit-upvote-using-javascript/?p=115851

 

snippet for the name would be 

 

set(#name,$eval("document.querySelector(\"#details > div.content > div.info > div > div.address > h3\").textContent"),"Global")

 

might look a bit complicated Using Eval but it really is not

 

Or what is easier is using my CSS Selector Plugin

 

http://network.ubotstudio.com/forum/index.php/topic/18575-css3-selector-for-ubot-my-first-pluginxpath-alternative/

 

script with that plugin would be

 

set(#name,$plugin function("CSSPluging.dll", "$CSS Selector", $document text, "#details > div.content > div.info > div > div.address > h3", "TextContent"),"Global")

Thank you.

I will try your plugin.

 

Update: your plugin is awesome. It's so easy to select the specific element now. Thank you

Edited by hoanglo
  • Like 1
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...