In this tutorial, we use BeautifulSoup and Requests in Python to pull the market cap of a stock (AAPL) from Yahoo Finance. Next, we set our program to run everyday and to send us an sms text message with the results.
#Wayscript #Python #Scrape
Register at [ Ссылка ]
Want to clone this script to your own account?
[ Ссылка ]
Follow WayScript on Social Media:
GitHub - [ Ссылка ]
Twitter - [ Ссылка ]
Linkedin - [ Ссылка ]
Instagram - [ Ссылка ]
Facebook - [ Ссылка ]
Code from the Tutorial (Updated 4/6/2020)
''''''''
import requests
from bs4 import BeautifulSoup
ticker = 'AAPL'
url = '[ Ссылка ]' + ticker
res = requests.get( url )
html = res.text
soup = BeautifulSoup( html, 'html.parser' )
market_cap_elem = soup.find( 'td', { 'data-test' : 'MARKET_CAP-value' } )
market_cap = market_cap_elem.text
print( ticker, 'Market Cap', market_cap )
variables[ 'MarketCap' ] = market_cap
''''''
Ещё видео!