Answer the question
In order to leave comments, you need to log in
Parsing data from a widget on a local page?
Polling data acc. and parsing once a second, in order to avoid waiting for responses to a request from a remote page, I placed the service widget on a local page, I open it once with a Google driver and read it as often as I need. The problem is that the browser sees the incoming values, but it doesn’t work to take it for parsing, I see the script and some kind of nonsense. Please help me with a working example, if it is feasible in principle.
Widget page on drive C
<!DOCTYPE html>
<head>
<meta http-equiv=Content-Type content="text/html;charset=UTF-8">
<title>ind</title>
</head>
<body>
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div class="tradingview-widget-container__widget"></div>
<div class="tradingview-widget-copyright">
<a href="https://www.tradingview.com/markets/indices/" rel="noopener" target="_blank">
<span class="blue-text">Indices</span></a> by TradingView</div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-market-quotes.js" async>
{
"width": 770,
"height": 450,
"symbolsGroups": [
{
"name": "Indices",
"originalName": "Indices",
"symbols": [
{
"name": "XETR:DAX",
"displayName": "DAX"
},
{
"name": "CURRENCYCOM:VIX",
"displayName": "VIX"
},
{
"name": "CURRENCYCOM:US500",
"displayName": "SIP"
},
{
"name": "CME:SP1!",
"displayName": "FSIP"
}
]
}
],
"colorTheme": "light",
"isTransparent": false,
"locale": "en"
}
</script>
</div>
<!-- TradingView Widget END -->
</body>
from selenium import webdriver
import time
from bs4 import BeautifulSoup
options = webdriver.ChromeOptions()
#options.add_argument('headless')
browser = webdriver.Chrome(options=options)
browser.get('file:///C:/start/ind.html')
time.sleep(5)
page = browser.page_source
soup = BeautifulSoup(page, 'html.parser')
print(soup)
browser.quit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question