How can I get html of a website with retrofit
?
for example I have this url and I need to get html of this url and how can I load more .
Bellow is my code :
MainActivity.java:
public class MainActivity extends AppCompatActivity {
TextView txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt = (TextView) findViewById(R.id.txt);
OkHttpClient okHttpClient = new OkHttpClient().newBuilder()
.build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://www.instagram.com/elde0596/")
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
final Interface_Web request = retrofit.create(Interface_Web.class);
Call<ResponseBody> call = request.getHtml();
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
txt.setText(response.body().source().toString());
Log.i("SDADASDAWEQ", "A " + response.body().toString());
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.i("SDADASDAWEQ", "B " + t.getMessage());
}
});
}
}
Interface_Web.java :
public interface Interface_Web {
@GET("/")
Call<ResponseBody> getHtml();
}
Just show me :
[size=9500 text=<!DOCTYPE html>\n<!--[if lt IE 7]> <html lang="en" class="no…]
But I need to see all of html
.