I’ve an app, which is parsing some html page. Now I’m doing it in this way:
-
I load whole html (without resources of course, just pure html)
-
I parse only elements which I need (this is small part of page)
-
do some work on this
What I need is to do not donwload complete html as it is pretty big and I need only small portion of it – I would like to download only some part of web page, is this possible? It’s because of fact, that on mobiles are usually much slower internet connection, and there are also much smaller data limits.
If you want to, say, download just the middle of the page, that’s not possible. You could potentially stream the first n bytes of data using URLConnection and the inputstream provided if you knew the data you needed was within the first n bytes. Then convert the contents of that stream into a String that you can feed into JSoup and hope it can parse that fragment.