import requests
from bs4 import BeautifulSoup
import re
from json import loads
soup = BeautifulSoup(requests.get(
    'http://finance.yahoo.com/quote/AAPL/profile?p=AAPL').content)
script = soup.find('script', text=re.compile('root.App.main')).text
data = loads(re.search('root.App.main\\s+=\\s+(\\{.*\\})', script).group(1))
print(data)
How to understand this raw HTML of Yahoo! Finance when retrieving data using Python?