Help with scrape - probinex.com

Hello,
I am trying to get the latest USD value from a page : https://www.probinex.com to a sensor by using scrape feature. I am playing with it for a while, but debug mode of scraper is not helpful.

I tried diferent selects:

#main > div:nth-child(1) > div.section-body.in-viewport > div:nth-child(3) > div.col.col-1-12.grid-5-12 > div.block.block-box.box.box--default.box--pbx-wrapper.box-inherit-color > div:nth-child(3) > div > div > div > div.pbx-last > span
#body > div:nth-child(1) > div:main > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > div.pbx-box > div.pbx.last
#main > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > div.pbx-box > div.pbx.last

But clearly I am missing some point. Can anyone help me with this one?
Thank you in advance.

You’re over-complicating it trying to get tools to do it for you. Just look at the HTML (View Source, not DevTools, to check that the number is actually in the original HTML):

<div id="main" class="main" role="main">
<div class="section height--low align--middle color--inverse section-width-wide section-has-background"><div class="section-body"><div class="row-main"><div class="col col-1-12 grid-12-12"><div class="block block-html" data-lb="region" data-lb-id="sections.0.rows.0.columns.0.regions.0"><script>
        (function (w,d,s,o,f,js,fjs) {
            w['ecm-widget']=o;w[o] = w[o] || function () { (w[o].q = w[o].q || []).push(arguments) };
            js = d.createElement(s), fjs = d.getElementsByTagName(s)[0];
            js.id = '16-008646c414ce6adc8637fedebcbf087a'; js.dataset.a = 'probinex'; js.src = f; js.async = 1; fjs.parentNode.insertBefore(js, fjs);
        }(window, document, 'script', 'ecmwidget', 'https://d70shl7vidtft.cloudfront.net/widget.js'));
    </script></div></div></div>
<div class="row-main"><div class="col col-1-12 grid-12-12"><div class="block block-spacer" data-lb="region" data-lb-id="sections.0.rows.1.columns.0.regions.0"><div class="block-spacer-element" style="height:70px"></div></div></div></div>
<div class="row-main"><div class="col col-1-12 grid-5-12"><div class="block block-box box box--default box--pbx-wrapper box-inherit-color"><div class="row"><div class="col col-1-12 grid-12-12"><div class="block block-image" data-lb="region" data-lb-id="sections.0.rows.2.columns.0.regions.0.rows.0.columns.0.regions.0"><div class="image image-mask ratio-original" style="padding-bottom:90.31531531531532%"><img class="is-lazy" data-srcset="https://www.probinex.com/files/responsive/360/0/token-3d.png 360w,https://www.probinex.com/files/responsive/640/0/token-3d.png 444w" data-sizes="(min-width:1375px) 573px, (min-width:641px) 41.67vw, (min-width:480px) 100.00vw, (min-width:320px) 100.00vw, 100.00vw" /><noscript><img srcset="https://www.probinex.com/files/responsive/360/0/token-3d.png 360w,https://www.probinex.com/files/responsive/640/0/token-3d.png 444w" sizes="(min-width:1375px) 573px, (min-width:641px) 41.67vw, (min-width:480px) 100.00vw, (min-width:320px) 100.00vw, 100.00vw"></noscript></div></div></div></div>
<div class="row"><div class="col col-1-12 grid-12-12"><div class="block block-inline pbx-labels" data-lb="region" data-lb-id="sections.0.rows.2.columns.0.regions.0.rows.1.columns.0.regions.0">Last PBX price</div></div></div>
<div class="row"><div class="col col-1-12 grid-12-12"><div class="block block-html" data-lb="region" data-lb-id="sections.0.rows.2.columns.0.regions.0.rows.2.columns.0.regions.0"><div class="pbx-box">
<div class="pbx-last">
<span>0.10041</span>&nbsp;USD
</div>

The number you want is in the first <span> in <div id="main">, so:

select: "div#main span"
index: 0

or:

image

gives this (I didn’t both with names, units or device classes):

image

Haha, that’s so easy if someone knows “how” :slight_smile:
Thank you very much

1 Like

It’s a bit of an art. What I usually do is start with the element I want, then work up the tree until I can find something unique to anchor it to. That usually means either a unique element like <body> or an element with an id, because that should only occur once whereas the same class can be applied to many elements.

So here, start with the <span> and work up to <div id="main"> giving a select of div#main span. You don’t need to call out all of the intermediate elements, as the select works recursively unless you specify otherwise using >.