info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open an article in google groups


From: Reiner Steib
Subject: Re: open an article in google groups
Date: Thu, 28 May 2009 22:27:48 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux)

On Thu, May 28 2009, Leo wrote:

> I wonder if anyone know how to relate an article with its location in
> google groups. I am trying to write a command to view articles in google
> groups. I found it useful at times. Many thanks.

,----[ (info "(gnus)Finding the Parent") ]
|    Here's an example setting that will first try the current method, and
| then ask Google if that fails:
| 
|      (setq gnus-refer-article-method
|            '(current
|              (nnweb "google" (nnweb-type google))))
`----

,----[ (info "(gnus)Choosing Commands") ]
| `G j'
| `j'
|      Ask for an article number or `Message-ID', and then go to that
|      article (`gnus-summary-goto-article').
`----

> At the moment, I am appending the msg-id to
> http://groups.google.com/groups?selm= to get the target url but this
> does not work reliably.

In Gnus, this is done in `nnweb.el'.  Whenever Google changes the HTML
pages, it may break.  I'm not sure about the current state.  I have an
uncommitted patch for `nnweb.el' here (not really tested):

--8<---------------cut here---------------start------------->8---
--- nnweb.el    22 Jan 2009 07:02:16 -0000      7.40
+++ nnweb.el    28 May 2009 20:25:02 -0000
@@ -71,6 +71,11 @@
      (address . "http://groups.google.com/groups";)
      (base    . "http://groups.google.com";)
      (identifier . nnweb-google-identity))
+    (howardk
+     (id . 
"http://howardk.freenix.org/msgid.cgi?STYPE=msgid&MSGI=<%s>&GOOGLE=on")
+     (article . nnweb-howardk-wash-article)
+     (reference . identity)
+     (identifier . nnweb-howardk-identity))
     (gmane
      (article . nnweb-gmane-wash-article)
      (id . "http://gmane.org/view.php?group=%s";)
@@ -303,7 +308,27 @@
 ;;; groups.google.com
 ;;;
 
+;; Updated for Google's changed interface 2008-11
 (defun nnweb-google-wash-article ()
+  (let ((case-fold-search t) url)
+    (goto-char (point-min))
+    (if (or (re-search-forward "The requested message.*could not be found."
+                              nil t)
+           (re-search-forward
+            (concat "href=\"\\(/group/[^/]+/msg/[[:alnum:]]+"
+                    "\\?dmode=source\\)\">Show original</a>") nil t))
+       (setq url (format "%s%s&output=gplain"
+                         (nnweb-definition 'base) (match-string 1)))
+      (gnus-message 3 "Requested article not found"))
+    (gnus-message 9 "URL: %s" url)
+    (erase-buffer)
+    (mm-with-unibyte-current-buffer
+      (mm-url-insert-file-contents url))
+    (unless (re-search-forward "^Message-ID:")
+      (gnus-message 3 "Requested article not found")
+      (erase-buffer))))
+
+(defun nnweb-howardk-wash-article ()
   ;; We have Google's masked e-mail addresses here.  :-/
   (let ((case-fold-search t)
        (start-re "<pre>[\r\n ]*")
@@ -312,6 +337,7 @@
     (if (save-excursion
          (or (re-search-forward "The requested message.*could not be found."
                                 nil t)
+             (re-search-forward "Couldn't find article" nil t)
              (not (and (re-search-forward start-re nil t)
                        (re-search-forward end-re nil t)))))
        ;; FIXME: Don't know how to indicate "not found".
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]