Parsing HTML from InputStream #177
-
I have browsed the documentation, but I could only find examples from loading a URL or a File. What about InputStream? How can I load HTML from an InputStream? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey, But since you can parse from string as mentioned here in the readme, you could just convert your inputstream to a string as a workaround. Here is a little example how to convert inputstream to string and parse with skrapeit: // assuming you have a variable called 'inputStream'
val value: String = inputStream.bufferedReader().use(BufferedReader::readText)
htmlDocument(value) {
// do stuff with the parsed html like selecting elements here
} I opened issue #178 to implement InputStream support. If you like to, PRs are always welcome (and it should be easy to implement), otherwise it will maybe take a little while since someone picks it or I find time |
Beta Was this translation helpful? Give feedback.
-
parsing direclty from InputStream has been added by #178 and will be part of next release (1.2.0) |
Beta Was this translation helpful? Give feedback.
Hey,
Passing inputstream is not build-in right now (but a good idea, we should implement that).
But since you can parse from string as mentioned here in the readme, you could just convert your inputstream to a string as a workaround.
Here is a little example how to convert inputstream to string and parse with skrapeit:
I opened issue #178 to implement InputStream support.
If you like to, PRs are always welcome (and it should be easy to implement), otherwise it will maybe…