Gnus development mailing list
 help / color / mirror / Atom feed
* gmane_link -- extract some URLs to a gmane article
       [not found] <87hc424lwh.fsf@jidanni.org>
@ 2009-01-17 21:50 ` jidanni
  0 siblings, 0 replies; only message in thread
From: jidanni @ 2009-01-17 21:50 UTC (permalink / raw)
  To: gmane-discuss; +Cc: ding

#!/usr/bin/perl

# Gentlemen, as you know on Gmane some articles, e.g.,
# http://article.gmane.org/gmane.org.wikimedia.mediawiki.api/873/raw
# lack the Archived-At: <http://permalink.gmane.org/gmane.org.wikimedia.mediawiki.api/873>
# header, even though that URL very much exists.

# That's where I step in. My masterfully crafted script below extracts
# the pertinent substitute links. Whilst not total "breast
# reconstruction" for the damaged article, at least the two substitute
# URLs should mean no more groping for the right links to tell your
# friends.

# In fact we print all the Gmane links for the article possible to
# compute offline we can, including those computed from any
# Archived-At header actually present.

# One might ask "why not fix the damage at the source?" Well it's
# attitudes like that lead to long unemployment lines!

# gmane_link -- extract some URLs to a gmane article fed in on stdin
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : http://jidanni.org/
# Created On      : Sun Jan 18 04:24:07 2009
# Last Modified On: Sun Jan 18 05:48:58 2009
# Update Count    : 41
use strict;
use warnings FATAL => 'all';
while (<>) {
    if (/^Message-ID: <(.*)>/) {
        print <<EOF;
http://mid.gmane.org/$1
http://news.gmane.org/find-root.php?message_id=$1
EOF
    }
    elsif (/^Archived-At: <(.*)>/) {
        $_ = $1;
        print "$_\n";
        s/permalink(?=\.gmane)/article/ or die 'Not Gmane?';
        print "$_\n";
        s@$@/raw@;
        print "$_\n";
    }
    elsif (/^$/) { exit; }
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-17 21:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87hc424lwh.fsf@jidanni.org>
2009-01-17 21:50 ` gmane_link -- extract some URLs to a gmane article jidanni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).