[英]getting images in xml file from imgur for android
I am trying to get the images in xml file from the imgur website.我正在尝试从 imgur 网站获取 xml 文件中的图像。
This is the code I have written:这是我写的代码:
try {
HttpClient client = new DefaultHttpClient();
String getURL = "http://api.imgur.com/2/account/images.xml";
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
HttpEntity mResEntityGet = responseGet.getEntity();
if (mResEntityGet != null) {
//do something with the response
String content = EntityUtils.toString(mResEntityGet);
}
} catch (ClientProtocolException e) {}
} catch (IOException e) {}
The problem is that the row "HttpResponse responseGet = client.execute(get);"问题是行“HttpResponse responseGet = client.execute(get);” throws IOexception.
抛出 IO 异常。
If I write the url in the explorer then it gives me the following XML:如果我在资源管理器中编写 url,那么它会给我以下 XML:
<?xml version="1.0" encoding="utf-8" ?>
- <error>
<message>This method requires authentication</message>
<request>/2/account/images.xml</request>
<method>get</method>
<format>xml</format>
<parameters />
</error>
Any idea how can I get the xml file with the images from the imgur website?知道如何从 imgur 网站获取带有图像的 xml 文件吗?
I thought you need to provide login details see http://api.imgur.com/auth我认为您需要提供登录详细信息,请参阅http://api.imgur.com/auth
https://imgur.com/r/ {SUBREDDIT ID}/page/0.xml
https://imgur.com/r/ {SUBREDDIT ID}/page/0.xml
https://api.imgur.com/2/album/ {ALBUM ID}
https://api.imgur.com/2/album/ {专辑 ID}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.