Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Realtime-yahoo-stock_price

from bs4 import BeautifulSoup
import requests


url = 'https://finance.yahoo.com/quote/VTSAX?p=VTSAX&.tsrc=fin-srch'
page = requests.get(url, headers={
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36",
})
soup = BeautifulSoup(page.text, 'html.parser')
price = soup.find('fin-streamer', {'class': 'Fw(b) Fz(36px) Mb(-4px) D(ib)'}).text

print(price)
Comment

PREVIOUS NEXT
Code Example
Python :: pairplot markersize 
Python :: pairplot legend position 
Python :: split string into words and separators 
Python :: pandas dataframe how to store 
Python :: python regex type hint 
Python :: collecion.alt shopify python 
Python :: Insertion Sorting using while in python 
Python :: Specifying your data type 
Python :: range function without end value 
Python :: Python Anagram Using sorted() function 
Python :: Code Example of Checking if a variable is None using == operator 
Python :: PHP echo multi lines Using Heredoc variable 
Python :: python finding mead 
Python :: faceModel = "opencv_face_detector_uint8.pb" 
Python :: pass method 
Python :: mavproxy arm 
Python :: python adding an item 
Python :: transfer learning in python with custom dataset 
Python :: find not in dafatrame series 
Python :: Python NumPy ravel function example array.ravel is equivalent to reshape(-1, order=order) 
Python :: odoo 15 documentation 
Python :: Python NumPy asscalar Function Example 02 
Python :: watchlist flask app 
Python :: if statment with logical or operator for multiple varaibles 
Python :: NumPy resize Example out of bound values [appending zeros] 
Python :: visualize 3 columns of pandas 
Python :: should either include a `queryset` attribute, 
Python :: adjoint of 3x3 matrix in numpy 
Python :: how to do alignment of fasta in biopython 
Python :: python get dataframe vlaues where cell is higher than 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =