Skip to content

Parsing HTML from InputStream #177

Answered by christian-draeger
HubKing asked this question in Q&A
Discussion options

You must be logged in to vote

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:

// 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…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by christian-draeger
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants