我正在创建一个Instagram的帖子下载器的Android应用程序。如何我下载私人图片和视频从Instagram的复制共享的URL在Android。我使用下面的代码。请帮助我这是在此代码中丢失。
if (stringData.matches("https://www.instagram.com/(.*)")) {
String[] data = stringData.split(Pattern.quote("?"));
String string = data[0];
Log.i("TAG", "data: string "+string);
if (isNetworkAvailable()) {
Log.i("TAG", "data: isNetworkAvailable IF "+isNetworkAvailable());
if (Method.isDownload) {
Log.i("TAG", "data: Method.isDownload IF "+Method.isDownload);
AsyncHttpClient client = new AsyncHttpClient();
client.get(string + "?__a=1", null, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
//Some thing went to wrong
}
});
} else {
//First of all one download complete then after you can another download
}
} else {
//No Internet Connection
}
} else {
//No supported
}
1条答案
按热度按时间tf7tbtn21#
这个代码没有问题,你可以从公共资料下载。2但是一旦你从私人帐户访问数据,你就会得到错误。3你必须从Instagram给予登录密码,这样私人数据才能被提取。