hoanglo 3 Posted November 19, 2015 Report Share Posted November 19, 2015 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. Quote Link to post Share on other sites
pash 504 Posted November 19, 2015 Report Share Posted November 19, 2015 use "element offset" or "regex" try set(#Name,$scrape attribute($element offset(<tagname="h3">,0),"innertext"),"Global") 1 Quote Link to post Share on other sites
deliter 203 Posted November 19, 2015 Report Share Posted November 19, 2015 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") Quote Link to post Share on other sites
hoanglo 3 Posted November 19, 2015 Author Report Share Posted November 19, 2015 (edited) 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 November 19, 2015 by hoanglo 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.