Repository navigation
Conversation
Yahoo retired /xhr/ncp (it now answers 404 {"message":"Not Found"}), so
get_news() silently returned [] for every symbol and tab (ranaroussi#3004).
The quote news page now loads its list from a GraphQL query
(financeTickerList / mlRecsStream) on nexus-finance-prod.media.yahoo.com.
get_news() now sends the same query, follows the cursor when more items
are requested than one page returns, skips items Yahoo cannot serve
(AssetError), and maps each asset into the article dict callers already
use ({"id", "content": {"title", "summary", "pubDate", "provider",
"canonicalUrl", "clickThroughUrl", "thumbnail", ...}}).
Articles come back newest first: the API has no sort parameter, but
setting the rank input's aboutnessWeight to 0 (the news page uses 0.05)
makes Yahoo rank purely by recency, so count=N returns the N most recent
articles.
Tabs map to Yahoo's list slugs: news -> ticker-news, all -> ticker-all,
press releases -> ticker-pressrelease.
YfData.post() gains an optional headers argument, needed for the
x-yahoo-cg-client-name header the GraphQL gateway requires.
Build the news list slug (finance-<region>-<lang>) and clientContext from yf.config.locale instead of hardcoding US / en-US. Cache is keyed on (count, tab, lang, region). Yahoo only has news lists for some locales (en-US, en-GB, en-CA, en-AU, en-NZ, en-IN, en-SG, de-DE, fr-FR, fr-CA, es-ES, it-IT, zh-Hant-HK, zh-Hant-TW). Others return NOT_FOUND, which gives an empty list with a debug log instead of an error log. Co-authored-by: Rene <dwaddle@users.noreply.github.com>
|
Read the diff (not run against Yahoo), two small things in the
Does the |
|
Good catches! Pushed a commit with both fixes and tests:
|
|
Read 3afb664 (not run). Both fixes look right: One gap in the stalled-cursor test: its second page is |
|
Spot on, thanks! Updated the test in a266a5b to include an |
|
Thanks for the a266a5b update; the page-3 case is what makes the guard observable. One more edge to consider: if page 2 returns a new cursor but every edge is an |
|
Currently Yahoo's cursor ( Pushed 5039c7b adding an explicit ceiling Also, Mehdy has pulled the stalled-cursor guard and empty cache fixes into #3018 (in 11ebed1). Whichever PR @ValueRaider prefers to merge is great by me! |
|
Read 5039c7b (diff only, tests not run). The cap closes the case I asked about: |
|
Added that debug line in 447a70a when |
|
Closing as superseded and merged via #3018. |
Fixes #3004. Supersedes #3018.
Taking over #3018 as requested by @ValueRaider:
get_news()to Yahoo's GraphQL endpoint (financeTickerList->mlRecsStream) with recency ranking (aboutnessWeight: 0), mapping assets back to the existing article schema.yf.config.localefor the news list slug andclientContext, with no per-call method argument.(count, tab, lang, region).