atreadw1492/yahoo_fin

list index out of range

vvu1980 opened this issue · 0 comments

Hello!
I am trying extract historical earnings dates from Yahoo Finance, but received an error for almost all tickers i have tried. How this problem can be solved?

aapl_earnings_hist = si.get_earnings_history("CAT")


IndexError Traceback (most recent call last)
C:\Windows\temp/ipykernel_3464/159781704.py in
----> 1 aapl_earnings_hist = si.get_earnings_history("CAT")

C:\ProgramData\Anaconda3\lib\site-packages\yahoo_fin\stock_info.py in get_earnings_history(ticker)
834 url = 'https://finance.yahoo.com/calendar/earnings?symbol=' + ticker
835
--> 836 result = _parse_earnings_json(url)
837
838 return result["context"]["dispatcher"]["stores"]["ScreenerResultsStore"]["results"]["rows"]

C:\ProgramData\Anaconda3\lib\site-packages\yahoo_fin\stock_info.py in _parse_earnings_json(url, headers)
807 content = resp.content.decode(encoding='utf-8', errors='strict')
808
--> 809 page_data = [row for row in content.split(
810 '\n') if row.startswith('root.App.main = ')][0][:-1]
811

IndexError: list index out of range