# Is this even possible?

**URL:** <https://discourse.nodered.org/t/is-this-even-possible/78036>\
**Category:** General\
**Created:** [29 April 2023 22:00 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036 "2023-04-29T22:00:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [29 April 2023 22:00 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/1 "2023-04-29T22:00:31Z")

</div>

Can this be done, If this "widget" is ran on a web page it will return the price for WTI Crude Oil.  
Is there a way for me to run this code and extract the WTI price and get it formattted as a json object?

```auto
<!-- Crude Price Script - OILCRUDEPRICE.COM -->
<div style="width:238px; border:1px solid #2D6AB4;height:auto;background-color:#FFFFFF;font-family:Arial,sans-serif;"><div style="background-color:#2D6AB4;width:100%; margin:0 auto;font-weight:bold;text-align:center; padding-top:0px;"><a href="https://www.oilcrudeprice.com/" style="font-size:20px; color:#FFFFFF;text-decoration:none;" rel="nofollow">WTI Crude Price</a></div><script src="https://www.oilcrudeprice.com/oilwidget.php?m=000000&g=FFFFFF&c=2D6AB4&i=FFFFFF&l=76A4FB&o=E6F2FA&w=240&u=wti"></script></div>
<!-- End of Crude Price Script -->

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [29 April 2023 22:03 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/2 "2023-04-29T22:03:40Z")

</div>

Well, my question would be:  
_What do you get back from this script?_

Saves me loading it and running it.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [29 April 2023 23:01 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/3 "2023-04-29T23:01:58Z")

</div>

You want to extract the price from [https://www.oilcrudeprice.com/wti-oil-price/](https://www.oilcrudeprice.com/wti-oil-price/)?

It seems like an http request node and an HTML parse node set to extract p#wtip will do it.

```auto
"77.74 US Dollar -0.13 (-0.17%)"

```

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [30 April 2023 00:59 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/4 "2023-04-30T00:59:29Z")

</div>

> [@jbudd](#):
>
> parse node set to extract p#wtip

Could you provide me with an example of how this would look in the HTML parse node?

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [30 April 2023 04:09 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/5 "2023-04-30T04:09:38Z")

</div>

Thanks for the pointer, I have been able to figure out what I need and I have it working. Once again thanks for the help

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [30 April 2023 10:28 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/6 "2023-04-30T10:28:32Z")

</div>

If I visit the [oilcrudeprice.com](http://oilcrudeprice.com) page today it gives me one price, and changes it after a second or two:  
 ![Untitled 3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/bef9c73972fd06dcc3b7bcf615ad720e2755f038.jpeg)

![Untitled 4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/2856f23ec054c1cb28bb7e2695dcba619e85213f.jpeg)

Scraping the data with the HTML parse node gives the first value $77.74. (same as it did last night)

Does this indicate that the site falsifies the initial data to discourage scraping?

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [30 April 2023 13:07 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/7 "2023-04-30T13:07:38Z")

</div>

In my opinion, I don't think so. This data is stock market data and depending on who they actually get their information from will depend on how often the "REAL-TIME" values are updated.

Some stock market data is not updated over the weekends while other's are.  
And I'm only using this data as a "Guideline", for "Estimated Daily Production Values".

But thanks for the heads up.

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [1 May 2023 11:14 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/8 "2023-05-01T11:14:12Z")

</div>

jbudd, Thank you for your detailed observation. You was correct. I'm back to the drawing board.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 May 2023 11:14 UTC](https://discourse.nodered.org/t/is-this-even-possible/78036/9 "2023-05-15T11:14:38Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
