From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68175 Path: news.gmane.org!not-for-mail From: jidanni@jidanni.org Newsgroups: gmane.discuss,gmane.emacs.gnus.general Subject: gmane_link -- extract some URLs to a gmane article Date: Sun, 18 Jan 2009 05:50:19 +0800 Message-ID: <87ocy5d2lg.fsf@jidanni.org> References: <87hc424lwh.fsf@jidanni.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232229042 10864 80.91.229.12 (17 Jan 2009 21:50:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 17 Jan 2009 21:50:42 +0000 (UTC) Cc: ding@gnus.org To: gmane-discuss@hawk.netfonds.no Original-X-From: gmane-discuss-bounces@hawk.netfonds.no Sat Jan 17 22:51:55 2009 Return-path: Envelope-to: gd-gmane-discuss@m.gmane.org Original-Received: from hawk.netfonds.no ([80.91.224.246]) by lo.gmane.org with esmtp (Exim 4.50) id 1LOJ4z-0004gJ-8e for gd-gmane-discuss@m.gmane.org; Sat, 17 Jan 2009 22:51:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=hawk.netfonds.no) by hawk.netfonds.no with esmtp (Exim 3.36 #1 (Debian)) id 1LOJ3i-0003M0-00; Sat, 17 Jan 2009 22:50:26 +0100 Original-Received: from sd-green-bigip-177.dreamhost.com ([208.97.132.177] helo=homiemail-a1.g.dreamhost.com) by hawk.netfonds.no with esmtp (Exim 3.36 #1 (Debian)) id 1LOJ3h-0003Lv-00 for ; Sat, 17 Jan 2009 22:50:25 +0100 Original-Received: from jidanni.org (122-127-32-36.dynamic.hinet.net [122.127.32.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by homiemail-a1.g.dreamhost.com (Postfix) with ESMTP id D26D8119E23; Sat, 17 Jan 2009 13:50:21 -0800 (PST) X-BeenThere: gmane-discuss@hawk.netfonds.no X-Mailman-Version: 2.1.5 Precedence: list List-Id: gmane-discuss.hawk.netfonds.no List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: gmane-discuss-bounces@hawk.netfonds.no Errors-To: gmane-discuss-bounces@hawk.netfonds.no Xref: news.gmane.org gmane.discuss:12104 gmane.emacs.gnus.general:68175 Archived-At: #!/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: # 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 </) { $_ = $1; print "$_\n"; s/permalink(?=\.gmane)/article/ or die 'Not Gmane?'; print "$_\n"; s@$@/raw@; print "$_\n"; } elsif (/^$/) { exit; } }