Yes, thank you. I know that task is not so trivial, TLD is not so easy problem. That's why I thought that this functionality probably should be added to the core. But I watched another languages and solutions and released that because of this list is changing over time - the best solution is to use side library On Sun, 26 Mar 2017 at 17:42 Myron Marston <[email protected]> wrote:
> It's not quite clear to me what you mean by "naked domain". If it's just > the last two parts of the fully qualified domain name in the given URI, > then yes, it's trivial enough to write a function to get that yourself. > However, many applications are concerned with what the *registrable > domain* is. For example, from `foo.bar.baz.com` it's `baz.com` but from > `foo.bar.baz.co.uk` it's `baz.co.uk` (the last 3 parts, in this case!). > There's no algorithm for doing this correctly, but mozilla maintains the > public suffix list that can be used for this purpose: > > https://publicsuffix.org/ > > We wrote an Elixir library that operates on these rules which you might > find useful: > > https://github.com/seomoz/publicsuffix-elixir > > Myron > > On Sunday, March 26, 2017 at 2:39:06 AM UTC-7, Dmitry Rubinstein wrote: > > Hello! > > > I want to propose some new features in URI module. > > First one is naked domain, which works something like this > > assert "http://foo.bar.baz.com" |> URI.parse |> Map.get(:naked_domain) == > "baz.com" > or > assert "http://foo.bar.baz.com" |> URI.naked_domain == "baz.com" > > And subdomain method: > > assert "http://foo.bar.baz.com" |> URI.subdomain("baz.com") == "foo.bar" > assert "http://foo.bar.baz.com" |> URI.subdomain("bar.baz.com") == "foo" > > May be it can be relevant. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "elixir-lang-core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elixir-lang-core/2ncr8joN8Pg/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/1f2a3d0b-3551-4165-bf86-fb74235ff79d%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/1f2a3d0b-3551-4165-bf86-fb74235ff79d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAEfOyNK_1DFW6iMs_nNTUZxMxjYjCCkjr7BRebM0SZ-GKzfi4A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
