Created
March 6, 2021 21:48
-
-
Save bwasti/8e277f9ae7e20aa98e0f01a92650a936 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# $ python logo.py gme | |
# https://s3-symbol-logo.tradingview.com/gamestop--big.svg | |
import requests | |
import sys | |
def get_symbol(symbol): | |
url = "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query={}®ion=1&lang=en".format(symbol) | |
result = requests.get(url).json() | |
for x in result['ResultSet']['Result']: | |
if x['symbol'] == symbol: | |
return x['name'] | |
company = get_symbol(sys.argv[1].upper()) | |
name = company.split(' ')[0].split(',')[0] | |
name = name.lower() | |
logo = f"https://s3-symbol-logo.tradingview.com/{name}--big.svg" | |
print(logo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment