Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YahooJson returning 404 not found #318

Closed
bentziaxl opened this issue Jul 14, 2023 · 4 comments · Fixed by #320
Closed

YahooJson returning 404 not found #318

bentziaxl opened this issue Jul 14, 2023 · 4 comments · Fixed by #320
Labels
module malfunction report about malfunctioning module

Comments

@bentziaxl
Copy link

https://query2.finance.yahoo.com/v11/finance/quoteSummary/APPL?modules=price,summaryDetail,defaultKeyStatistics

output:
{"finance":{"result":null,"error":{"code":"Not Found","description":"HTTP 404 Not Found"}}}

@bpschuck
Copy link
Contributor

Probably the last nail in the coffin for YahooJSON. The module will likely be removed in the next Finance::Quote release unless someone can identify another finance.yahoo.com api that returns JSON. Already some reports posted to another issue which becomes a red herring if access is completely denied.

Please, no "me too" comments.

Sorry, but we have no control over what Yahoo chooses to allow access to.

@bpschuck bpschuck added the module malfunction report about malfunctioning module label Jul 14, 2023
@khorton
Copy link

khorton commented Jul 14, 2023

FWIW, the LibreOffice Financials-Extension still manages to scrap data from Yahoo, as of a few minutes ago. Maybe whatever trick they are using in their Python code can be replicated in Perl

@jeckersb
Copy link

I see the webpage calls out to the chart API which appears to have at least some of the information, most notably current price and previous close. I'm not familiar enough with the code to know what else (if anything) would be required. Hopefully it's helpful.

https://query1.finance.yahoo.com/v8/finance/chart/AAPL

$ curl -s https://query1.finance.yahoo.com/v8/finance/chart/AAPL | jq .chart.result[0].meta
{
  "currency": "USD",
  "symbol": "AAPL",
  "exchangeName": "NMS",
  "instrumentType": "EQUITY",
  "firstTradeDate": 345479400,
  "regularMarketTime": 1689344613,
  "gmtoffset": -14400,
  "timezone": "EDT",
  "exchangeTimezoneName": "America/New_York",
  "regularMarketPrice": 191.105,
  "chartPreviousClose": 190.54,
  "previousClose": 190.54,
  "scale": 3,
  "priceHint": 2,
  "currentTradingPeriod": {
    "pre": {
      "timezone": "EDT",
      "start": 1689321600,
      "end": 1689341400,
      "gmtoffset": -14400
    },
    "regular": {
      "timezone": "EDT",
      "start": 1689341400,
      "end": 1689364800,
      "gmtoffset": -14400
    },
    "post": {
      "timezone": "EDT",
      "start": 1689364800,
      "end": 1689379200,
      "gmtoffset": -14400
    }
  },
  "tradingPeriods": [
    [
      {
        "timezone": "EDT",
        "start": 1689341400,
        "end": 1689364800,
        "gmtoffset": -14400
      }
    ]
  ],
  "dataGranularity": "1m",
  "range": "1d",
  "validRanges": [
    "1d",
    "5d",
    "1mo",
    "3mo",
    "6mo",
    "1y",
    "2y",
    "5y",
    "10y",
    "ytd",
    "max"
  ]
}

@bpschuck
Copy link
Contributor

I also discovered either of these will work (hostname can be query2 or query1).

https://query2.finance.yahoo.com/v11/finance/quoteSummary/?symbol=AAPL&modules=price,summaryDetail,defaultKeyStatistics

or

https://query2.finance.yahoo.com/v10/finance/quoteSummary/?symbol=AAPL&modules=price,summaryDetail,defaultKeyStatistics

While waiting for a new release to be pushed to CPAN, in YahooJSON.pm change the $YIND_URL_HEAD and $YIND_URL_TAIL declarations to:

my $YIND_URL_HEAD = 'https://query2.finance.yahoo.com/v11/finance/quoteSummary/?symbol=';
my $YIND_URL_TAIL = '&modules=price,summaryDetail,defaultKeyStatistics';

Thanks.

bpschuck added a commit to bpschuck/finance-quote that referenced this issue Jul 15, 2023
@bpschuck bpschuck linked a pull request Jul 15, 2023 that will close this issue
bpschuck added a commit that referenced this issue Jul 15, 2023
Fixes related to YahooJSON API URL - Issue #318
bpschuck added a commit that referenced this issue Aug 12, 2023
	* Consorsbank.pm - New module - PR #329
	* Stooq.pm - New module - Issue #203
	* Bloomberg.pm - Changed modules to utilize cookie jar - PR #331 - Issue #324
	* AlphaVantage.pm - Apply currency scaling (GBp -> GBP) when symbol
	  had additional ".X" suffix - Issue #281
	  Fixed check for "Information" JSON usually returned when daily API
	  limit has been reached.
	* YahooWeb.pm - Fixed incorrect pricing for single character symbols
	  and changed URL to get trade date - Issues #314 #319
	* Another fix to the URL in YahooJSON and CurrencyRates/YahooJSON - Issue #318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module malfunction report about malfunctioning module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants