News for hackers. Stuff that matters.
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by darrenf on Friday June 14, 2019 @06:50AM (#20181927)
To the OP: I would suggest normalising the protocol. Your examples show that you retain the case from the raw data:

    "protocol": "HTTP"
    "protocol": "https"
As it stands, users will end up normalising by themselves and you can save them the effort. FWIW this part is typically called the scheme, not protocol (e.g. Perl has `URI::Find::Schemeless` which performs a similar task)

    URI = scheme:[//authority]path[?query][#fragment]
See https://tools.ietf.org/html/rfc3986#section-3

To that end, you might also want to consider adding support for fragments. :)

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by felixfbecker on Friday June 14, 2019 @07:56AM (#20182218)
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by JoBrad on Friday June 14, 2019 @08:04AM (#20182260)
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by noobiemcfoob on Friday June 14, 2019 @09:16AM (#20182681)
Congratulations! You're all right!
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by darrenf on Friday June 14, 2019 @08:43AM (#20182493)
Interesting, thanks. I have virtually zero JS experience so didn't know that, and were I to try and pick it up this would've been a surprise to me - I naively assumed it would use the same terminology as the RFC and the libraries in languages with which I am familiar (rust, golang, python, perl). A quick look for the URI data type in a handful of other languages shows they also use "scheme". JS appears to be the outlier here.
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by seandougall on Friday June 14, 2019 @10:52AM (#20183480)
In particular, the scheme doesn't necessarily refer to a protocol (e.g. application-specific schemes like `chrome:` that don't involve network access at all).
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by appleflaxen on Friday June 14, 2019 @05:55AM (#20181711)
I can't figure out what this tool does, even after spending several minutes on the linked github page, and following the npmjs link on that page.

But clearly HN likes it (it's number two...); can anyone explain it to me?

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by darkwater on Friday June 14, 2019 @06:13AM (#20181782)
Looks like it's able to detect URL in "natural language" texts. Like for example "this is alinkhttps://wikipedia.org". Check a live demo at https://jsfiddle.net/AndrewKang/xtfjn8g3/
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by np_tedious on Friday June 14, 2019 @07:41AM (#20182138)
I think the "no-protocol" in the post message suggests the http(s) part is unnecessary. Makes sense - it's a pretty easy problem when the scheme is there
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by prashnts on Friday June 14, 2019 @06:37AM (#20181879)
I’m just wondering if it can parse things like « pls-no-spam at google’s email service », which a human can easily parse to [email protected]. I suppose POS tagging with some heuristics can get it working for a few cases.

And if it can, I feel the most users for this would be email harvesting spam bots. Which would not be super nice. Although in ideal and less common scenarios it could actually be useful for IR purposes.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by albertgoeswoof on Friday June 14, 2019 @06:47AM (#20181914)
Not sure why people bother to use the << spam at google's email >> approach when they can use an email forwarding service that lets you turn email addresses off, like https://idbloc.co (disclaimer, I built this)
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by omegabravo on Friday June 14, 2019 @07:03AM (#20181973)
I think these are a great idea. The reason that people use that method is because it is free, and the suggested alternative costs money.

I typically use throw away email addresses instead since they're free. If I actually want to use the service/account some day I'll sign up properly.

I expect someday the primary email providers will generate aliases on demand.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by myu701 on Friday June 14, 2019 @10:18AM (#20183203)
Fastmail lets you convert [email protected] to [email protected]

It's not a literal alias, but it works out fine.

One of these days I'm going to propose the Thunderbird + K-9 mail addons that say 'set the sent from email address to be equal to the sent to email address', that way if [email protected] is the recipient, it will be the sender to any replies, rather than the MUA default replying with [email protected] (but that's a separate discussion)

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by asdkhadsj on Friday June 14, 2019 @03:22PM (#20185898)
I didn't know that was possible, really neat!
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by giancarlostoro on Friday June 14, 2019 @07:45AM (#20182167)
> I typically use throw away email addresses instead since they're free. If I actually want to use the service/account some day I'll sign up properly.

The example above is about giving a direct line to be contacted through email on a personal site or blog, heck even a professional one.

> I expect someday the primary email providers will generate aliases on demand.

I know at least ProtonMail does it. But also theres the email#[email protected] trick that works nicely enough.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by prashnts on Friday June 14, 2019 @07:55AM (#20182212)
That example is quite common within academic context: most of the researchers and professors I know, who have a university homepage, use this.

I guess its because they do want legitimate people to reach them easily (students, collaborators etc) and if spams do go through — well they'd probably ignore it, just like they ignore other emails.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by sametmax on Friday June 14, 2019 @06:55AM (#20181949)
Because I don't want to shutdown the address later: people may try to use it to reach me.

I use anti spam addresses to register to new services.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by perseaalexandra on Friday June 14, 2019 @06:57AM (#20181960)
Not sure why people bother using idbloc.co instead of burnermail.io
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by OJFord on Friday June 14, 2019 @06:46AM (#20181909)
Sanitising user input seems a good use-case too - I'd like it built in to my email client, for example.

(More likely to be useful than Outlook's typically wildly incorrect guesses at when someone's suggesting a meeting/calendar event!)

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by sildur on Friday June 14, 2019 @08:34AM (#20182431)
It fails with ipv6 URLs like http://[::1]:3001/
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by jakeogh on Friday June 14, 2019 @01:51PM (#20185039)
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by p1mrx on Friday June 14, 2019 @08:34PM (#20187766)
Hacker News also fails to parse that. Give it another decade or two; we'll figure out how URLs work.
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by Avamander on Friday June 14, 2019 @09:36AM (#20182830)
Not the first time newly built stuff can't handle IPv6... quite sad.
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by playpause on Friday June 14, 2019 @05:58AM (#20181723)
Why "pattern-dreamer"?
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by jxub on Friday June 14, 2019 @05:31AM (#20181602)
It looks interesting, but the readme nor the title doesn't make clear what is the project about. Would someone care to explain?
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by mgliwka on Friday June 14, 2019 @05:55AM (#20181714)
This project attempts to parse url's and email addresses from text, even when the protocol is missing or they're mangled in some other fashion (i.e. google.com/test-url?id=2 gets parsed and identified as valid URL, but invalid.nontld/test not. Or "[email protected] Text" get's parsed as [email protected])
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by gray_-_wolf on Friday June 14, 2019 @07:24AM (#20182068)
So it needs to be updated every time new tld is added? That seems... suboptimal. Also it will not work for intranet addresses (valid.insidemylan/test).
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by YesThatTom2 on Friday June 14, 2019 @07:21AM (#20182053)
Suggestion: change parse to extract

That would be even more clear.

Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by ken on Friday June 14, 2019 @09:11AM (#20182629)
FWIW, Apple’s implementation of this is called “NSDataDetector”.
Re:Show HN: Parse no-protocol URL, no-domain URI and email a... by andrew-kang-g on Sunday June 16, 2019 @05:34AM (#20194682)
Thanks for all the comments. Now ip-v6 and intranet cases are available to be extracted from v 1.6.