Closed peetzweg closed 7 years ago
I currently have this, but its not working great and is not tested at all, should definitely write test for that one!
const parseURL = rawURL => { const uriDecoded = decodeURIComponent(rawURL); const url = new Buffer(uriDecoded, 'base64').toString('ascii'); // reverse base64 encoding const regex = /https?\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i; const elements = url.match(regex); return { domain: elements[1], resource: elements[0] }; };
https://www.quora.com/Whats-the-best-method-to-extract-article-text-from-HTML-documents
Should be done on the client side, way easier through the document.location object.
https://developer.mozilla.org/en-US/docs/Web/API/Location
I currently have this, but its not working great and is not tested at all, should definitely write test for that one!