HTML parsing in Elixir with leex and yecc(notes.eellson.com)
notes.eellson.com
HTML parsing in Elixir with leex and yecc
https://notes.eellson.com/2017/01/22/html-parsing-in-elixir-with-leex-and-yecc/
6 comments
The best library I've found for this sort of thing is gumbo. https://github.com/google/gumbo-parser
With its help I've created scrapers and crawlers that digest even the most disgusting HTML.
With its help I've created scrapers and crawlers that digest even the most disgusting HTML.
Hmm... This seems more like XML parsing to me than HTML parsing - in particular, there's no handling of (completely valid) omitted end tags.
Definitely interesting though.
Definitely interesting though.
The article mentions Floki which incidentally just added support for the servo/html5ever parser written in rust.
https://github.com/hansihe/ex_html5ever
Excellent article about creating parsers though even if html parsing is a particularly difficult problem.
https://github.com/hansihe/ex_html5ever
Excellent article about creating parsers though even if html parsing is a particularly difficult problem.
Floki is a great lib, used it to write a very basic URL polling CLI tool in just 72 lines of code: https://github.com/vikeri/proba/blob/master/lib/proba.ex
As the author says, this is a toy project to learn Elixir; don't use in production, especially not on dynamic/user content.
https://github.com/basho/riak_ql
Specifically:
https://github.com/basho/riak_ql/blob/develop/src/riak_ql_le...
https://github.com/basho/riak_ql/blob/develop/src/riak_ql_pa...
It is a very concise and well written piece of software.