Код: Выделить всё
def get_name(ticker):
import requests, re
# put the URL here
url =f'https://finance.yahoo.com/quote/{ticker}/profile'
# download
req = requests.get(url, headers = {'User-Agent': ua})
html = req.text
try:
# use a regular expression to find the name
name = re.search(r'(?
Подробнее здесь: [url]https://stackoverflow.com/questions/78368680/profile-at-the-end-of-my-url-causing-web-scraping-function-to-not-work[/url]