A site mapper built in Elixir.
Add it to your mix.exs
:
{:sitemappex, "~> 0.1", github: "doomspork/sitemappex"}
To use Sitemappex
, there is the map_links/2
function. It takes two arguments, a starting URL and an optional list of whitelisted domains. The result of it is a list of tuples: [{url, occurrences}]
See it in action:
<html>
<body>
<a href="http://www.example.com/blog">Blog</a>
<a href="http://www.othersite.com">Blog</a>
</body>
</html>
Assumption: Neither "example.com/blog" or "othersite.com" have additional links.
iex> Sitemappex.map_links("http://example.com")
[{"http://www.example.com/blog", 1}, {"http://www.othersite.com", 1}]
iex> Sitemappex.map_links("http://example.com", ["example.com"])
[{"http://www.example.com/blog", 1}]
Feedback, feature requests, and fixes are welcomed and encouraged. Please make appropriate use of Issues and Pull Requests. All code should have accompanying tests.
Please see LICENSE for licensing details.