Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/debapriyasengupta28/domain-extraction

Extracting domains from lengthy strings of URLs can be cumbersome. Instead of manually sifting through extensive text to isolate site addresses, utilize this system to efficiently extract the site URL from any length URL string. Test cases are provided in the readme file for convenience
https://github.com/debapriyasengupta28/domain-extraction

Last synced: 8 days ago
JSON representation

Extracting domains from lengthy strings of URLs can be cumbersome. Instead of manually sifting through extensive text to isolate site addresses, utilize this system to efficiently extract the site URL from any length URL string. Test cases are provided in the readme file for convenience

Awesome Lists containing this project

README

        

# Domain-Extraction

Extract Domains from long string of URLs.

# Test cases

```
console.log(extractDomain("https://studio.youtube.com/channel/UCntj-iDUfMBvc8_peZWbQ4g/editing/sections"));
// Output: studio.youtube.com

console.log(extractDomain("https://www.youtube.com/"));
// Output: www.youtube.com

console.log(extractDomain("https://www.youtube.com/channel/UCntj-iDUfMBvc8_peZWbQ4g"));
// Output: www.youtube.com

console.log(extractDomain("https://www.flipkart.com/helpcentre?otracker=${otracker}_navlinks"));
// Output: www.flipkart.com

console.log(extractDomain("www.flipkart.com?web=true"));
// Output: www.flipkart.com

console.log(extractDomain("https://aniwatchtv.to/watch/ninja-kamui-19018?ep=119953"));
// Output: aniwatchtv.to

```