Scrape sensor (command line) - Processing incoming data

I am scraping price information from a website, getting one value with currency as the state value.

  1. How do I split the incoming value, so the state becomes the value, and the currency becomes an attribute?
  2. I also have a sensor with USD/NOK conversion.
    I want to use this in my python script to get the state (in NOK) to USD and currency attribute in USD. How do I use a sensor within my python script (transfer from the command line call or use the sensor directly in my script)?

Sensor:

  - platform: command_line
    name: Tavex - American Eagle gold coin 1oz
    command: "python3 /config/python_scripts/Tavex_gold.py"
    scan_interval: 3600

Script:

import datetime
import requests
from bs4 import BeautifulSoup
import lxml
import re


# URL for the table
url = 'https://tavex.no/gull/1oz-american-eagle-gold-coin/'
#grab the page
html = requests.get(url).text
#import into BS
soup = BeautifulSoup(html, "lxml")

link = 'product-poster__price-value js-product-price-from'
div = soup.find('span', {"class" : link})
text = div.string

print(text)
exit()

image