Skip to content

Commit

Permalink
Bugfix: Get logo url when no website exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jossan84 committed Sep 19, 2022
1 parent ec62797 commit 42e5751
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions yfinance/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,12 @@ def cleanup(data):

self._info['logo_url'] = ""
try:
domain = self._info['website'].split(
'://')[1].split('/')[0].replace('www.', '')
self._info['logo_url'] = 'https://logo.clearbit.com/%s' % domain
if not 'website' in self._info:
self._info['logo_url'] = 'https://logo.clearbit.com/%s.com' % self._info['shortName'].split(' ')[0].split(',')[0]
else:
domain = self._info['website'].split(
'://')[1].split('/')[0].replace('www.', '')
self._info['logo_url'] = 'https://logo.clearbit.com/%s' % domain
except Exception:
pass

Expand Down

0 comments on commit 42e5751

Please sign in to comment.