2
I am researching on web scraping. I have found dozens of pages, however, in none of them found how to extract information from dynamic pages.
Well, I’m trying to get the value of the LTCBRL cryptocurrency directly on the following website: https://br.tradingview.com/symbols/LTCBRL/
Below is the picture of the screen...
The tag on which the value is:
<span class="tv-symbol-header-quote__value tv-symbol-header-quote__value--large js-symbol-last">269.97</span>
I’d just like a tip on how to get the value.
The code provided by the colleague Jones Vieira was:
He informs that for it worked, however, for me present the error in the image below.
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome(
chrome_options = chrome_options,
service_args = ['--verbose']
)
driver.get('https://br.tradingview.com/symbols/LTCBRL')
wait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, 'tv-symbol-header-quote__value'))
)
value = driver.find_element_by_class_name('tv-symbol-header-quote__value').text
print(value)
https://scrapy.org
– MagicHat
you are trying to pick up the object that holds the value directly?
– RFL
@RFL yes. I am. It is that value 269.99, within the <span class="tv-Symbol-header-quote__value tv-Symbol-header-quote__value-large js-Symbol-last">269.97</span>
– Wilson Junior
I have researched so much and, I read in questions of other users that can be the issue of javascript.
– Wilson Junior
Have you tried using Selenium? https://selenium-python.readthedocs.io
– Jones Vieira
I already researched about, a little while ago. I’ll still need to learn how to use. I tried to get a code ready just for testing but it didn’t work.
– Wilson Junior
If someone told me that the library Selenium or any other would certainly work, I would study it knowing that the solution would be there... the point is that I have read enough and, aimlessly I feel lost.
– Wilson Junior