Open AlexPlatin opened 5 months ago
I see this issue as well.
import yfinance as yf
stock = yf.Ticker("TVSMOTOR.NS")
news = stock.news
print(news)
Returns "random" news or news from the main page.
Edit: Making the raw API call also returns the same faulty news. Looks like the error stems from the URL endpoint.
Same issue, hopefully they will fix the endpoint soon
straight up doesnt work now? raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
straight up doesnt work now? raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Yes, had that yesterday. Today it worked for a while and now it is giving this error again.
straight up doesnt work now? raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I believe this issue arose from yfinance/data.py
in YfData.get(...)
line 378, in particular when the first round of cookie strategy fails (perhaps due to rate limit or typo or some other reasons), it goes into a second cookie strategy, but the response is returned regardless of status code for the second round, so if the second request also returned 4xx
status code and response.json()
is called it'll raise a JSON decode error.
@utils.log_indent_decorator
def get(self, url, user_agent_headers=None, params=None, proxy=None, timeout=30):
# Important: treat input arguments as immutable.
if len(url) > 200:
utils.get_yf_logger().debug(f'url={url[:200]}...')
else:
utils.get_yf_logger().debug(f'url={url}')
utils.get_yf_logger().debug(f'params={params}')
proxy = self._get_proxy(proxy)
if params is None:
params = {}
if 'crumb' in params:
raise Exception("Don't manually add 'crumb' to params dict, let data.py handle it")
cookie, crumb, strategy = self._get_cookie_and_crumb()
if crumb is not None:
crumbs = {'crumb': crumb}
else:
crumbs = {}
if strategy == 'basic' and cookie is not None:
# Basic cookie strategy adds cookie to GET parameters
cookies = {cookie.name: cookie.value}
else:
cookies = None
request_args = {
'url': url,
'params': {**params, **crumbs},
'cookies': cookies,
'proxies': proxy,
'timeout': timeout,
'headers': user_agent_headers or self.user_agent_headers
}
response = self._session.get(**request_args)
utils.get_yf_logger().debug(f'response code={response.status_code}')
if response.status_code >= 400:
# Retry with other cookie strategy
if strategy == 'basic':
self._set_cookie_strategy('csrf')
else:
self._set_cookie_strategy('basic')
cookie, crumb, strategy = self._get_cookie_and_crumb(proxy, timeout)
request_args['params']['crumb'] = crumb
if strategy == 'basic':
request_args['cookies'] = {cookie.name: cookie.value}
response = self._session.get(**request_args)
utils.get_yf_logger().debug(f'response code={response.status_code}')
return response
Adding a second status code check would prevent the error from being raised, and perhaps a wait period or backoff loop before going into the second strategy.
Describe bug
I used yfinance to get news from different companies listed on various stock exchanges using method news (.get_news()) and it worked very well.
However, starting from March 2024 the get_news() method returns news not related to given ticker. I believe it now returns news from the main page of Yahoo Finance (see Bad data proof. For example, I asked about "1A9.F" ticker and it returned 'relatedTickers': ['CMOPF'] news)
Simple code that reproduces your problem
import yfinance as yf msft = yf.Ticker("1A9.F") msft.news
Debug log
DEBUG Entering get() DEBUG url=https://query2.finance.yahoo.com/v1/finance/search?q=1A9.F DEBUG params=None DEBUG Entering _get_cookie_and_crumb() DEBUG cookie_mode = 'basic' DEBUG Entering _get_cookie_and_crumb_basic() DEBUG loaded persistent cookie DEBUG reusing cookie DEBUG crumb = 'f/nSB8VksED' DEBUG Exiting _get_cookie_and_crumb_basic() DEBUG Exiting _get_cookie_and_crumb() DEBUG response code=200 DEBUG Exiting get()
Bad data proof
{'count': 13, 'explains': [], 'lists': [{'brandSlug': 'yahoo-finance', 'dailyPercentGain': 0.8398355065208919, 'followerCount': 61456, 'iconUrl': 'https://edgecast-img.yahoo.net/mysterio/api/110f1012357c7b3e87d14912e7023f819b61278e7f0e90a3825821d2ef3c427c/finance/resizefill_w96_h96/https://s.yimg.com/uc/fin/img/most-bought-activist.png', 'index': 'most-bought-by-activist-hedge-funds', 'name': 'Most Bought By Activist Hedge Funds', 'pfId': 'most_bought_by_activist_hedge_funds', 'score': 15.645953, 'slug': 'most-bought-by-activist-hedge-funds', 'symbolCount': 18, 'type': 'ALGO_WATCHLIST', 'userId': '5SSSFLJVWAMDKUGZM5HLSSBNAY'}, {'brandSlug': 'yahoo-finance', 'dailyPercentGain': 0.5050837217231051, 'followerCount': 41686, 'iconUrl': 'https://edgecast-img.yahoo.net/mysterio/api/f1b1a50dcfdddcf42a67d2da1bb1c341e6f65992b3d89154b9020ae8a9ffa004/finance/resizefill_w96_h96/https://s.yimg.com/uc/fin/img/mostboughtHedgeFunds.png', 'index': 'most-bought-by-hedge-funds', 'name': 'Most Bought By Hedge Funds', 'pfId': 'most_bought_by_hedge_funds', 'score': 10.904234, 'slug': 'most-bought-by-hedge-funds', 'symbolCount': 30, 'type': 'ALGO_WATCHLIST', 'userId': '5SSSFLJVWAMDKUGZM5HLSSBNAY'}, {'brandSlug': 'yahoo-finance', 'dailyPercentGain': 1.119014997698063, 'followerCount': 29897, 'iconUrl': 'https://edgecast-img.yahoo.net/mysterio/api/9f2d41c327a5d20c8062b14f526038441141d5644b2b3a0efee2e12d9be1efe0/finance/resizefill_w96_h96/https://s.yimg.com/uc/finance/social/portfolio/most-watched.png', 'index': 'most-watched', 'name': 'Most Watched by Yahoo Finance Users', 'pfId': 'most_watched', 'score': 7.611414, 'slug': 'most-watched', 'symbolCount': 30, 'type': 'ALGO_WATCHLIST', 'userId': '5SSSFLJVWAMDKUGZM5HLSSBNAY'}, {'brandSlug': 'trea', 'dailyPercentGain': -0.2682118695951419, 'followerCount': 23819, 'iconUrl': 'https://edgecast-img.yahoo.net/mysterio/api/3c7c7b592c7aba2beee72abb1e520b85d6241aee639ea2e8033b96962ad2e126/finance/resizefill_w96_h96/https://s.yimg.com/uc/fin/img/iStock-476433472.png', 'index': 'the-fight-against-covid19', 'name': 'The Fight Against COVID19', 'pfId': 'the_fight_against_covid19', 'score': 6.4065385, 'slug': 'the-fight-against-covid19', 'symbolCount': 13, 'type': 'ALGO_WATCHLIST', 'userId': 'X3NJ2A7VDSABUI4URBWME2PZNM'}], 'nav': [], 'news': [{'link': 'https://finance.yahoo.com/m/41621b45-a35e-3ee7-9bfc-83208f5ef88b/warren-buffett-vs.-carl.html', 'providerPublishTime': 1717391040, 'publisher': 'Motley Fool', 'relatedTickers': ['IEP'], 'thumbnail': {'resolutions': [{'height': 933, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/7BnUe4BeZ..bO6lLQiG3bg--~B/aD05MzM7dz0xNDAwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/motleyfool.com/9b1a29f472887a127d65d8a72b330520', 'width': 1400}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/qV4yrQGnvrOhp7Fa395lrw--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/motleyfool.com/9b1a29f472887a127d65d8a72b330520', 'width': 140}]}, 'title': 'Warren Buffett vs. Carl Icahn: Is Berkshire Hathaway or ' 'Icahn Enterprises a Better Stock for You?', 'type': 'STORY', 'uuid': '41621b45-a35e-3ee7-9bfc-83208f5ef88b'}, {'link': 'https://finance.yahoo.com/news/analysis-trial-investors-weigh-trump-050333950.html', 'providerPublishTime': 1717391013, 'publisher': 'Reuters', 'thumbnail': {'resolutions': [{'height': 533, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/fxWMIZxYI0EUrxpXdLnJXw--~B/aD01MzM7dz04MDA7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/reuters-finance.com/9c25d93290d6c1bce07a03726d8cfebf', 'width': 800}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/TKLIoWj6NLK673W.kZxJzQ--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/reuters-finance.com/9c25d93290d6c1bce07a03726d8cfebf', 'width': 140}]}, 'title': 'Analysis-After trial, investors weigh Trump 2.0 factor as ' 'election looms', 'type': 'STORY', 'uuid': 'acf48aba-d381-3c12-95c6-4fbc0c335aa3'}, {'link': 'https://finance.yahoo.com/m/87a0f0e5-7ebd-390d-a58d-2e22605357cc/dow-jones-futures-rise%3B.html', 'providerPublishTime': 1717390973, 'publisher': "Investor's Business Daily", 'relatedTickers': ['NVDA', '^GSPC', '^DJI', 'COMP', 'QCOM'], 'thumbnail': {'resolutions': [{'height': 563, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/vN4.NUyvgiN_4UzIAKqlBQ--~B/aD01NjM7dz0xMDAwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/ibd.com/a0e93b56357fe572742d0fcf66117149', 'width': 1000}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/5zGENOL9gogmWSQfoXJyZg--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/ibd.com/a0e93b56357fe572742d0fcf66117149', 'width': 140}]}, 'title': 'Dow Jones Futures Rise; Nvidia CEO Touts Next AI Chips, ' 'And So Does AMD', 'type': 'STORY', 'uuid': '87a0f0e5-7ebd-390d-a58d-2e22605357cc'}, {'link': 'https://finance.yahoo.com/news/cosmo-bring-real-time-ai-050200583.html', 'providerPublishTime': 1717390920, 'publisher': 'Newsfile', 'relatedTickers': ['CMOPF'], 'title': 'Cosmo to Bring Real-Time AI into Intelligent Medical ' 'Devices with NVIDIA IGX', 'type': 'STORY', 'uuid': '0ccd689d-f2c2-3863-bc7e-9f7e149e5209'}, {'link': 'https://finance.yahoo.com/news/formosa-laboratories-completes-acquisition-synchem-050100973.html', 'providerPublishTime': 1717390860, 'publisher': 'PR Newswire', 'thumbnail': {'resolutions': [{'height': 16, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/C5YjYIGSs0oai2fzZGJL5w--~B/aD0xNjt3PTE2O2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/prnewswire.com/f2c7aa95a346d7cd28e0120b7e61e4c6', 'width': 16}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/dy5WZBH1sCwBZhngOOveZw--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/prnewswire.com/f2c7aa95a346d7cd28e0120b7e61e4c6', 'width': 140}]}, 'title': 'Formosa Laboratories Completes the Acquisition of Synchem ' 'to Expand North American CDMO Footprint', 'type': 'STORY', 'uuid': '2469b825-9891-3edd-9117-bd53abbc27b4'}, {'link': 'https://finance.yahoo.com/news/alk-presents-positive-phase-3-050000824.html', 'providerPublishTime': 1717390800, 'publisher': 'GlobeNewswire', 'relatedTickers': ['AKBLF'], 'thumbnail': {'resolutions': [{'height': 39, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/TFRWuPjwySPHeuzcZu7baA--~B/aD0zOTt3PTE0MjthcHBpZD15dGFjaHlvbg--/https://media.zenfs.com/en/globenewswire.com/848fac2aa05860966f3ec6e476ae2174', 'width': 142}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/ThuNbcPP_Feh2fkyTF1kLA--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/globenewswire.com/848fac2aa05860966f3ec6e476ae2174', 'width': 140}]}, 'title': 'ALK presents positive phase 3 paediatric trial data ' 'offering new hope for children with respiratory allergies', 'type': 'STORY', 'uuid': '03b1801d-740e-3e3c-8e32-35ae99f88f74'}, {'link': 'https://finance.yahoo.com/news/uae-host-games-future-2025-050000491.html', 'providerPublishTime': 1717390800, 'publisher': 'PR Newswire', 'thumbnail': {'resolutions': [{'height': 267, 'tag': 'original', 'url': 'https://s.yimg.com/uu/api/res/1.2/OSxSsuhRfOm.xhRvI8EnDA--~B/aD0yNjc7dz00MDA7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/prnewswire.com/787202b2246b38029f0bbe86ecc77e2e', 'width': 400}, {'height': 140, 'tag': '140x140', 'url': 'https://s.yimg.com/uu/api/res/1.2/JPxiXY91JZUYybL6Xz9.8A--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/prnewswire.com/787202b2246b38029f0bbe86ecc77e2e', 'width': 140}]}, 'title': 'UAE TO HOST GAMES OF THE FUTURE 2025', 'type': 'STORY', 'uuid': '160df24c-fc26-34ce-9879-09c29aa5bc1c'}, {'link': 'https://finance.yahoo.com/news/start-day-message-050000714.html', 'providerPublishTime': 1717390800, 'publisher': 'GlobeNewswire', 'title': 'Start of Day Message', 'type': 'STORY', 'uuid': '218e0d81-069c-3803-b0db-d14c1cffe14d'}], 'quotes': [{'exchDisp': 'Frankfurt', 'exchange': 'FRA', 'index': 'quotes', 'industry': 'Gold', 'industryDisp': 'Gold', 'isYahooFinance': True, 'longname': 'Asante Gold Corporation', 'quoteType': 'EQUITY', 'score': 2000100.0, 'sector': 'Basic Materials', 'sectorDisp': 'Basic Materials', 'shortname': 'ASANTE GOLD CORP.', 'symbol': '1A9.F', 'typeDisp': 'Equity'}], 'researchReports': [], 'screenerFieldResults': [], 'timeTakenForAlgowatchlist': 400, 'timeTakenForCrunchbase': 0, 'timeTakenForCulturalAssets': 0, 'timeTakenForNav': 400, 'timeTakenForNews': 700, 'timeTakenForPredefinedScreener': 400, 'timeTakenForQuotes': 428, 'timeTakenForResearchReports': 0, 'timeTakenForScreenerField': 0, 'totalTime': 37}
yfinance
version0.2.40
Python version
3.10
Operating system
Windows
I noticed that for this particular ticker 1A9.F
, when you use the full name of the company Asante Gold Corporation
it seems to returns properly relevance news.
t = "1A9.F" # Using the original ticker for the first try, which gives front-page news
r = requests.get(
url = f"https://query2.finance.yahoo.com/v1/finance/search?q={t}",
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
)
data = r.json()
print(data)
>>> ... 'news': [{'uuid': '03ab3a06-2fca-3f0b-a94e-7728b5db1ea0',
'title': "Parks Canada and partners take first step toward creating a national urban park in St. John's",
'publisher': 'CNW Group',
'link': 'https://finance.yahoo.com/news/parks-canada-partners-first-step-204500140.html',
'providerPublishTime': 1720471500,
'type': 'STORY',
'thumbnail': {'resolutions': [{'url': 'https://s.yimg.com/uu/api/res/1.2/zXZUNStn6b5.lW8TIWS5MA--~B/aD0zMDA7dz00MDA7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/cnwgroup.com/bad4812fef6c57928122ed62b23bf521',
'width': 400,
'height': 300,
'tag': 'original'},
{'url': 'https://s.yimg.com/uu/api/res/1.2/3wPCwm4YhXri9JmUAow1Rg--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/cnwgroup.com/bad4812fef6c57928122ed62b23bf521',
'width': 140,
'height': 140,
'tag': '140x140'}]}},
{'uuid': 'd791484e-8417-3aae-97fc-273446fc2995',
'title': 'Tesla Stock’s Win Streak Hits 9 Days. It Almost Didn’t Happen.',
'publisher': 'Barrons.com',
'link': 'https://finance.yahoo.com/m/d791484e-8417-3aae-97fc-273446fc2995/tesla-stock%E2%80%99s-win-streak-hits.html',
'providerPublishTime': 1720471380,
'type': 'STORY',
'thumbnail': {'resolutions': [{'url': 'https://s.yimg.com/uu/api/res/1.2/rHL2F56x3R2OPgKJZ_LqSQ--~B/aD02NDA7dz0xMjgwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/Barrons.com/e4a0d77b5267671e4800b437969ca49d',
'width': 1280,
'height': 640,
'tag': 'original'} ...
t2 = data['quotes'][0]['longname'] # If use the longname from the previous quote instead, it works
r2 = requests.get(
url = f"https://query2.finance.yahoo.com/v1/finance/search?q={t2}",
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
)
data2 = r2.json()
print(data2)
>>> ... {'uuid': 'bae62caa-2116-3725-8a35-7e5c5ffc0487',
'title': 'Asante Files Financial and Operating Results for the Quarter Ended April 30, 2024',
'publisher': 'GlobeNewswire',
'link': 'https://finance.yahoo.com/news/asante-files-financial-operating-results-110000900.html',
'providerPublishTime': 1718622000,
'type': 'STORY',
'thumbnail': {'resolutions': [{'url': 'https://s.yimg.com/uu/api/res/1.2/IoEIOReUphFfMjBXXQ2w.g--~B/aD00Mzg7dz05Njg7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 968,
'height': 438,
'tag': 'original'},
{'url': 'https://s.yimg.com/uu/api/res/1.2/FAPh5S6ry5TgLH1N90GGkA--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 140,
'height': 140,
'tag': '140x140'}]},
'relatedTickers': ['ASGOF']},
{'uuid': '405254d2-bde0-3fd9-9f69-8d00a37067bf',
'title': 'Asante Announces Project Update for the Sulphide Recovery Plant at the Bibiani Gold Mine',
'publisher': 'GlobeNewswire',
'link': 'https://finance.yahoo.com/news/asante-announces-project-sulphide-recovery-111500095.html',
'providerPublishTime': 1718277300,
'type': 'STORY',
'thumbnail': {'resolutions': [{'url': 'https://s.yimg.com/uu/api/res/1.2/IoEIOReUphFfMjBXXQ2w.g--~B/aD00Mzg7dz05Njg7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 968,
'height': 438,
'tag': 'original'},
{'url': 'https://s.yimg.com/uu/api/res/1.2/FAPh5S6ry5TgLH1N90GGkA--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 140,
'height': 140,
'tag': '140x140'}]},
'relatedTickers': ['ASGOF']},
{'uuid': '347918dd-bc9b-3853-9de1-6d2afb247150',
'title': 'Asante Announces Rerouting of Bibiani-Goaso Highway, Paving the Way to Grow Gold Production at the Bibiani Gold Mine',
'publisher': 'GlobeNewswire',
'link': 'https://finance.yahoo.com/news/asante-announces-rerouting-bibiani-goaso-110000022.html',
'providerPublishTime': 1718276400,
'type': 'STORY',
'thumbnail': {'resolutions': [{'url': 'https://s.yimg.com/uu/api/res/1.2/IoEIOReUphFfMjBXXQ2w.g--~B/aD00Mzg7dz05Njg7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 968,
'height': 438,
'tag': 'original'},
{'url': 'https://s.yimg.com/uu/api/res/1.2/FAPh5S6ry5TgLH1N90GGkA--~B/Zmk9ZmlsbDtoPTE0MDtweW9mZj0wO3c9MTQwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/globenewswire.com/ad2b25f2467b60b1f2b65ac649423e4a',
'width': 140,
'height': 140,
'tag': '140x140'}]},
'relatedTickers': ['ASGOF']} ...
I think it might be worth looking into adding a recursive search method, but it doesn't work every time. For instance, the same strategy fails when used with TVSMOTOR.NS
. It does seem like it's more common with non-US securities tho.
After additional research, I've noticed that the function doesn't work only with tickers that have dots in their names (1A9.F, ZOMATO.NS, TVSMOTOR.NS). In other cases, everything works as intended
I think it might be worth looking into adding a recursive search method, but it doesn't work every time. For instance, the same strategy fails when used with
TVSMOTOR.NS
. It does seem like it's more common with non-US securities tho.
As I understand full name works only if company have ticker option without dot in name e.g. Asante Gold Corporation have several tickers (1A9.F, 1A9.DU, 1A9.BE, ASE.CN, ASGOF) and full name request works and TVS Motor Company Limited have two tickers (TVSMOTOR.BO, TVSMOTOR.NS), both with dots in name.
Also, if I use ticker without dot in original code for Asante, code returns correct news
import yfinance as yf
msft = yf.Ticker("ASGOF")
msft.news
Describe bug
I used yfinance to get news from different companies listed on various stock exchanges using method news (.get_news()) and it worked very well.
However, starting from March 2024 the get_news() method returns news not related to given ticker. I believe it now returns news from the main page of Yahoo Finance (see Bad data proof. For example, I asked about "1A9.F" ticker and it returned 'relatedTickers': ['CMOPF'] news)
Simple code that reproduces your problem
Debug log
Bad data proof
yfinance
version0.2.40
Python version
3.10
Operating system
Windows