Aide web

In java this is what I would use khổng lồ tải về the html:

static public String savePage(final String URL) throws IOException String line = "", all = ""; java.net.URL myUrl = null; BufferedReader in = null; try myUrl = new URL(URL); in = new BufferedReader(new InputStreamReader(myUrl.openStream())); while ((line = in.readLine()) != null) all += line; finally if (in != null) in.close(); return all;The HTML I get by using this code in normal java is exactly what I need. However when I try using this code in Android Java (Android studio) the resulting HTML is incomplete and is not what I need. All I want is the HTML to lớn be exactly how it is on the actual liên kết.

This is what the HTML looks like when I download it in Android Java:

YouTube

This HTML is nothing like the website, Im trying to tải về it from. Ive sầu tried a lot of different methods for downloading html from websites & all give sầu me incomplete và random HTML like this.

Bạn đang xem: Aide web

I have sầu tried to lớn encode the URL và used libraries that I can use lớn tải về HTML but still no luchồng.

An explanation to lớn this & a maybe even code that would bởi what I want would be greatly appreciated. Android java is new to me so lots of details would help me underst& better.

Xem thêm: Hướng Dẫn Chẩn Đoán Và Điều Trị Ung Thư Trực Tràng Slideshare

Thank you


*

*

According to the comments, if you want to site to think you are not communicating with it from a thiết bị di động device, you need lớn set the User-Agent in the network request.


*

Thanks for contributing an answer lớn Staông chồng Overflow!

Please be sure to answer the question. Provide details and giới thiệu your research!

But avoid

Asking for help, clarification, or responding to lớn other answers.Making statements based on opinion; baông xã them up with references or personal experience.

To learn more, see our tips on writing great answers.


Post Your Answer Disthẻ

By clicking “Post Your Answer”, you agree lớn our terms of service, privacy policy and cookie policy


Not the answer you're looking for? Browse other questions tagged java android or ask your own question.


*

site thiết kế / biệu tượng công ty © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.3.31.38960


Staông xã Overflow works best with JavaScript enabled
*

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device & discthua thảm information in accordance with our Cookie Policy.