from bs4 import BeautifulSoup
import requests

class MoreYahooFinance:

    def __init__(self, stock_symbol):
        self.base_url = ('https://finance.yahoo.com/quote/')
        self.symbol = stock_symbol

    def build_url(self):
        self.full_url = self.base_url + self.symbol + '/key-statistics?p=' + self.symbol + '&.tsrc=fin-srch'
        return self.full_url

    def parser(self):
        self.more_info = requests.get(self.full_url)
        self.parsed_data = BeautifulSoup(self.more_info.content, "html.parser")
        return self.parsed_data

    def pull_table_data(self):
        table_data = self.parsed_data.findAll("table", {"class":"table-qsp-stats Mt(10px)"})
        table_rows = table_data[8].findAll("tr")
        print(table_rows[3].text.strip())




