Jump to content
UBot Underground

Using "and Operator" With Expath To Scrape


Recommended Posts

Hello

 

I want to scrape only the elements of (class="b_vlist2col b_deep") enclosed within div class = sb_adsb for which i am trying this code of using and

operator but it is not working

 

//*[@class="sb_add sb_adTA" and @class="b_vlist2col b_deep"]

 

 

 

<div class="sb_add sb_adTA"><h2 class=""><a href="https://www.bing.com/aclick?ld=e3ZNObXans5DN4H3J-W77U8TVUCUwgB8M-aC_0d4v208J8FVOK_5fuXredDOQvh2oIclSD0PGNA-CprfiwUUKL2n195s7zfgrNWsWh41B4iv6EFzCc9NTYn21G9fXpbBupsxzhxD-KFz-NpJlJ1RoQJ4SzIjxfP7DmG8WkM6EKz0rliBwh&u=aHR0cHMlM2ElMmYlMmZibG9nLmRyb3BzaGlwbGlmZXN0eWxlLmNvbSUyZndoYXQtaXMtZHJvcC1zaGlwcGluZyUyZiUzZnV0bV9zb3VyY2UlM2RiaW5nJTI2dXRtX21lZGl1bSUzZGNwYyUyNnV0bV9jYW1wYWlnbiUzZFV0aW1hdGVHdWlkZSUyNTIwJTI1N0MlMjUyMFRvcDMlMjUyMENvbXBldGl0b3IlMjUyMEtXcyUyNTIwJTI1N0MlMjUyMFVTJTI1MjAlMjU3QyUyNTIwRW5oYW5jZWRDUEMlMjZ1dG1fdGVybSUzZGRyb3BzaGlwJTI2dXRtX2NvbnRlbnQlM2RFeGFjdCUyNTIwS2V5d29yZHMlMjUyMCUyNTdDJTI1MjBUaWVyMQ" h="ID=SERP,5507.1,Ads"><strong>Drop Shipping</strong> 101 | Get 10 Days of Free Training</a></h2><div class="b_caption"><div class="b_attribution"><div class="b_adurl" style="max-width: 497px"><cite>blog.<strong>drops</strong>hiplifestyle.com/ultimate-guide</cite></div><div class="b_adcaret"><div class="infobubble_item" data-id="/control/AdChoiceAjax?ns=SERP&key=5448&id=2"><span class="sw_ddgn"></span></div></div></div><p class=""><span class="b_adSlug">Ad</span>Start your own dropship store &amp; join over 5,000 students in our community.</p><p>Drop shipping is a method of fulfilling eCommerce orders &amp; The Ultimate Guide To ...</p><p class="b_secondaryText callout_vis" data-partnertag="Ads.Callout">Drive Traffic&nbsp;· Wholesale Price&nbsp;· Special Offer&nbsp;· Play Online</p></div><div class="b_vlist2col b_deep"><ul><li><h3 class="ad_esltitle"><a href="https://www.bing.com/aclick?ld=e3uTaEQHN_5piuFPDuD6m8HDVUCUzUBL-aM3I1lMq4NjQlwvKmpuo6i-ObQAKsbtV4gxKGDOMIdcXc40pGhfgalnD2n7lKHaGxopexvAxXauPrIZAST89ovbuIWbtnp8kyvVvUdo915YSpeal160qiRdoAkHmPZ9OeXQXIOA98e9bBlBlY&u=aHR0cHMlM2ElMmYlMmZ3d3cuZHJvcHNoaXBsaWZlc3R5bGUuY29tJTJmbHAlMmZuaWNoZS1zZWxlY3Rpb24lMmYlM2Z1dG1fc291cmNlJTNkYmluZyUyNnV0bV9tZWRpdW0lM2RjcGMlMjZ1dG1fY2FtcGFpZ24lM2RVdGltYXRlR3VpZGUlMjUyMCUyNTdDJTI1MjBUb3AzJTI1MjBDb21wZXRpdG9yJTI1MjBLV3MlMjUyMCUyNTdDJTI1MjBVUyUyNTIwJTI1N0MlMjUyMEVuaGFuY2VkQ1BDJTI2dXRtX3Rlcm0lM2Rkcm9wc2hpcCUyNnV0bV9jb250ZW50JTNkRXhhY3QlMjUyMEtleXdvcmRzJTI1MjAlMjU3QyUyNTIwVGllcjE" h="ID=SERP,5509.1,Ads">187 Niches To Sell Online</a></h3><div>FREE List of eCommerce Niches</div><div>187 Proven Products That SELL</div></li></ul><ul><li><h3 class="ad_esltitle"><a href="https://www.bing.com/aclick?ld=e35UREERxKsfTcEfI9f5551zVUCUyG4WLWSkP7kl7eLzvXuWd_7olct1lf7jd67Zp7eM070P2lNSb3qu0JCEGUdhXPNpWAIwgFIXO0gxa-OWmNTUQhoz0razH1m4qujyW5Oh4a9S7_tXYBLiUxjTdKVllF2a9sFJQ0Nox6Q0YtlU757Sy8&u=aHR0cHMlM2ElMmYlMmZ3d3cuZHJvcHNoaXBsaWZlc3R5bGUuY29tJTJmbHAlMmZtaW5pLWNvdXJzZSUyZiUzZnV0bV9zb3VyY2UlM2RiaW5nJTI2dXRtX21lZGl1bSUzZGNwYyUyNnV0bV9jYW1wYWlnbiUzZFV0aW1hdGVHdWlkZSUyNTIwJTI1N0MlMjUyMFRvcDMlMjUyMENvbXBldGl0b3IlMjUyMEtXcyUyNTIwJTI1N0MlMjUyMFVTJTI1MjAlMjU3QyUyNTIwRW5oYW5jZWRDUEMlMjZ1dG1fdGVybSUzZGRyb3BzaGlwJTI2dXRtX2NvbnRlbnQlM2RFeGFjdCUyNTIwS2V5d29yZHMlMjUyMCUyNTdDJTI1MjBUaWVyMQ" h="ID=SERP,5510.1,Ads"><strong>Drop Shipping</strong> Training</a></h3><div>Get 10 Days of FREE Training</div><div>From eCommerce Expert Anton Kraly</div></li></ul></div></div>

Link to post
Share on other sites

Well that is within it so you don't want to use and here. And would be like if you wanted to say the class was named this and it also had a name of "x" or whatever. When you want another tag within the first you need to use a / and then another statement.

 

Try this:

//*[@class="sb_add sb_adTA"]/*[@class='b_vlist2col b_deep']
  • Like 1
Link to post
Share on other sites

Well that is within it so you don't want to use and here. And would be like if you wanted to say the class was named this and it also had a name of "x" or whatever. When you want another tag within the first you need to use a / and then another statement.

 

Try this:

//*[@class="sb_add sb_adTA"]/*[@class='b_vlist2col b_deep']

 

Hey man your posts here are always informative. If possible please do a separate for xpath operators like contains,AND,OR,BOTH,Either or Combination of operators.

Im sure a lot will find this information useful.

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