{"id":18890414,"url":"https://github.com/workingdog/scalapsl","last_synced_at":"2025-04-14T23:31:10.451Z","repository":{"id":57724080,"uuid":"43185201","full_name":"workingDog/scalaPSL","owner":"workingDog","description":"a scala library for the Public Suffix List","archived":false,"fork":false,"pushed_at":"2019-05-01T14:03:10.000Z","size":729,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T11:43:21.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workingDog.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-26T01:34:06.000Z","updated_at":"2021-08-04T20:42:27.000Z","dependencies_parsed_at":"2022-09-02T07:02:02.748Z","dependency_job_id":null,"html_url":"https://github.com/workingDog/scalaPSL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FscalaPSL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FscalaPSL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FscalaPSL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FscalaPSL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workingDog","download_url":"https://codeload.github.com/workingDog/scalaPSL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248978587,"owners_count":21192817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T07:55:30.117Z","updated_at":"2025-04-14T23:31:10.130Z","avatar_url":"https://github.com/workingDog.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Public Suffix List Scala API\n\nThis Scala library (**scalapsl**) presents a simple API to use the Public Suffix List[1]. With this library you can parse a **URL** into its component subdomains, such as: Top Level Domain (TLD), \nSecond Level Domain (SLD), Third Level Domain (TRD), etc... registrable domain and public suffix parts.\n\nFrom the [Public Suffix List](https://publicsuffix.org/):\n\nA \"public suffix\" is one under which Internet users can (or historically could) directly register names. \nSome examples of public suffixes are .com, .co.uk and pvt.k12.ma.us. \nThe Public Suffix List is a list of all known public suffixes.\nThe Public Suffix List is an initiative of Mozilla, but is maintained as a community resource. \nIt is available for use in any software, but was originally created to meet the needs of browser manufacturers. \nIt allows browsers to, for example:\n\n-  Avoid privacy-damaging \"supercookies\" being set for high-level domain name suffixes\n-  Highlight the most important part of a domain name in the user interface\n-  Accurately sort history entries by site.\n\nSince there was and remains no algorithmic method of finding the highest level at which a domain \nmay be registered for a particular top-level domain (the policies differ with each registry), \nthe only method is to create a list. This is the aim of the Public Suffix List. This Scala library is a basic conversion of the [Java code of reference 2](https://github.com/whois-server-list/public-suffix-list).\n\n\n## Documentation\n\nThe Public Suffix List is a list of simple rules for all known public suffixes, see [documentation](https://publicsuffix.org/).\n\n## Installation\n\nAdd the following dependency to your application *build.sbt*:\n\n    libraryDependencies += \"com.github.workingDog\" %% \"scalaspl\" % \"1.2\"\n\nNote the typo in the library name, should have been scalapsl.\n\nTo compile and generate an independent fat jar file from source, use [SBT](http://www.scala-sbt.org/):\n\n    sbt assembly\n\nThe jar file **scalapsl-1.3-SNAPSHOT.jar** will be in created in the *./target/scala-2.12* directory.\n\n\n## How to use\n\nVery simple to use, see the **Example.scala** and **TestApp.scala**.\n\nFrom *Example.scala*:\n\n        val psl = PublicSuffixList()\n        println(\"the public suffix of \\\"www.example.net\\\" is: \" + psl.publicSuffix(\"www.example.net\").get)\n        println(\"\\\"www.example.net\\\" is a public suffix: \" + psl.isPublicSuffix(\"www.example.net\"))\n        println(\"\\\"www.example.net\\\" is registrable: \" + psl.isRegistrable(\"www.example.net\"))\n        println(\"the registrable domain of: www.example.net is: \" + psl.registrable(\"www.example.net\").get)\n        println()\n        val domain = \"x.a.b.c.kobe.jp\"\n        println(\"domain: \" + domain + \"\\n  tld: \" + psl.tld(domain) + \"\\n  sld: \" + psl.sld(domain) + \"\\n  trd: \" + psl.trd(domain))\n        println()\n        println(\"domainLevel 1: \" + psl.domainLevel(domain, 1))\n        println(\"domainLevel 2: \" + psl.domainLevel(domain, 2))\n        println(\"domainLevel 3: \" + psl.domainLevel(domain, 3))\n        println(\"domainLevel 4: \" + psl.domainLevel(domain, 4))\n        println(\"domainLevel 5: \" + psl.domainLevel(domain, 5))\n        println()\n        psl.domainLevels(domain).foreach(lvl =\u003e println(\"domainLevels: \" + lvl))\n\n\nTo read the PSL directly from reference 1, you need to be connected to the internet and \nhave the following property set in the configuration file *application.conf*:\n \n    psl.url=\"https://publicsuffix.org/list/public_suffix_list.dat\"\n\nIf you do not want to read the list from the internet, but from a local file, use something like:\n\n    psl.url=\"file:///Users/.../scalaPSL/src/main/resources/public_suffix_list.dat\"\n\nSee *application.conf* example in the *./src/main/resources* directory.\n\n## References\n\n1) [The Public Suffix List](https://publicsuffix.org/)\n\n2) [Original java code](https://github.com/whois-server-list/public-suffix-list)\n\n3) [Other code](https://github.com/wrangr/psl)\n\n## Dependencies\n\nUses scala 2.12.8 and TypeSafe [Configuration library for JVM languages](https://github.com/typesafehub/config). \nThe latest *Public Suffix List* can be obtained from [The Public Suffix List on github](https://github.com/publicsuffix/list). \n\n## Status \n\nPasses all tests, see TestApp.scala and the [test file](https://raw.githubusercontent.com/publicsuffix/list/master/tests/test_psl.txt)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fscalapsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkingdog%2Fscalapsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fscalapsl/lists"}