在我的 android 应用程序中,当我尝试解析 spotify web api 时,页面返回 404。 URL 对我来说似乎没问题(http://ws.spotify.com/search/1/album.xml?q=album: 'Meteora'+艺术家:'Linkin Park'),但返回 404。
这是我的代码:
url = new URL("http://ws.spotify.com/search/1/album.xml?q=album:'" + albumName + "'+artist:'" +artistName +"'");
urlc = url.openConnection();
urlc.addRequestProperty("User-Agent", userAgent);
Log.v(TAG_SPOTIFY, "User-agent set: " + userAgent);
return this.parseSpotifyURI(urlc.getInputStream());
这是错误:
06-20 16:51:00.846: W/System.err(4962): java.io.FileNotFoundException: http://ws.spotify.com/search/1/album.xml?q=album:'Meteora'+artist:'Linkin Park'
06-20 16:51:00.846: W/System.err(4962): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)
06-20 16:51:00.846: W/System.err(4962): at com.micky.scanthings.music.ParseMusic.getSpotifyURI(ParseMusic.java:489)
...