I'm trying to use an existing .m file from a user (https://www.mathworks.com/matlabcentral/fileexchange/41940-james-o-shaughnessey-s-trending-value-screener). It appears that the file no longer is reading in data from a URL. The file hangs indefinitely until it is manually terminated. It appears no data is being read in. I'm not familiar with any of the java functions and reading the help files hasn't really helped much. Any suggestions or help would be appreciated. Thank you!

2 Kommentare

Geoff Hayes
Geoff Hayes am 5 Dez. 2018
Travis - have you tried stepping through the code to see what is happening? The stock URL (http://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65) is valid so it could be that there is a lot of data that has to be parsed (from the link, there appears to be about 176 pages and this code presumably reads each one).
Kevin Chng
Kevin Chng am 6 Dez. 2018
Or if you have datafeed toolbox, you may fetch data from those financial platform : bloomberg, fred, havar analytica, reuter thomson,...However, this web is not in the list of datafeed toolbox : https://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Travis L
Travis L am 7 Dez. 2018

0 Stimmen

I was able to figure out the issue. It was an issue with the URL needing to be https instead of http. The web browser was taking care of it, but there was an issue reading from the MATLAB file without the correct https. I appreciate the suggestions.

3 Kommentare

Hey Travis, I'm trying to run this code too. I changed http to https, but i get an error shown below. Any luck with this?
java.io.IOException: Server returned HTTP response code: 503 for URL: https://finance.yahoo.com/q/ks?s=ARCE+Key+Statistics
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
Travis L
Travis L am 7 Mai 2020
Hey Gianni, did you change all four instances of URLs to https? Do you get any output in the command window? I just verified that mine still runs. I have had issues in the past where I get similar failures midway through running. I believe it's an error on URL side or with the java retrieval. When I encounter this, I modify the code to continue running where it failed and that usually works.
Simon Prüller
Simon Prüller am 25 Feb. 2021
Hallo Travis, do you know how i can add a 'User-Agent' to the Java-Part? Because i get this Error:
Java exception occurred:
java.io.IOException: Server returned HTTP response code: 403 for URL: https://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at java.net.URL.openStream(URL.java:1045)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by