websave error when queryvalue contains "/"

1 回表示 (過去 30 日間)
Jeffrey Kern
Jeffrey Kern 2017 年 5 月 18 日
回答済み: Jeffrey Kern 2017 年 5 月 23 日
For the following url: https://query1.finance.yahoo.com/v7/finance/download/%5EGSPC?period1=1492522935&period2=1495114935&interval=1d&events=history&crumb=F49sxISRiT/ it looks like the last character is converted to %2F, and the website doesn't accept this. Can you help?
  1 件のコメント
Jan
Jan 2017 年 5 月 18 日
No, it does not look like the last character is converted. All we see is that the last charater is a "/". Why do you assume that a conversion happens and most of all for which command do you observe this? Why do you think, that the website reject this? In other words: Please post your code and explain, what happens. Then posting an answer is not based on guessing.

サインインしてコメントする。

採用された回答

Guillaume
Guillaume 2017 年 5 月 18 日
編集済み: Guillaume 2017 年 5 月 18 日
it looks like / is converted to %2F
And that would be entirely correct and the right thing to do. The encoding rule is very specific. / is a reserved character and must be percent encoded when used as anything else than a separator.
and the website doesn't accept this
I doubt that yahoo's website is faulty, so I'm certain that it would accept a %2F in the query string. In fact, I'm certain it would reject a URI that used / in the query string instead. Are you sure your problem is not because of something else? What is the exact error you get?

その他の回答 (1 件)

Jeffrey Kern
Jeffrey Kern 2017 年 5 月 23 日
The command was: websave('temp.csv','https://query1.finance.yahoo.com/v7/finance/download/%5EGSPC?period1=1492953255&period2=1495545255&interval=1d&events=history&crumb=F49sxISRiT/')
The resulting error was: "Error using websave (line 103) The server returned the message: "Request denied" for URL, 'https://query1.finance.yahoo.com/v7/finance/download/%5EGSPC?period1=1492953255&period2=1495545255&interval=1d&events=history&crumb=F49sxISRiT/' (with HTTP response code 999)."
However, if I enter the url in my browser with "%2F" instead of "/", I get the message "invalid cookie". Unfortunately, "crumb" changes frequently (today, it doesn't contain a slash) so this is difficult to repeat.

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by