Skip to content

Instantly share code, notes, and snippets.

@tantalor
Created November 8, 2013 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tantalor/7379471 to your computer and use it in GitHub Desktop.
Save tantalor/7379471 to your computer and use it in GitHub Desktop.
A perl script which outputs the usernames for new comments on Hacker News, preceded by the date.
#!/usr/bin/perl
my $url = "https://news.ycombinator.com/newcomments";
sub html {
`curl get $url 2>/dev/null`;
}
printf "# %s", `date`;
my @usernames;
for my $line (html()) {
my @usernames = ($line =~ m/href="user\?id=([^"]*)"/g);
# print $line;
for $username (@usernames) {
printf "%s\n", $username;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment