Function: nnweb-google-parse-1

nnweb-google-parse-1 is a byte-compiled function defined in nnweb.el.gz.

Signature

(nnweb-google-parse-1 &optional MESSAGE-ID)

Documentation

Parse search result in current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnweb.el.gz
(defun nnweb-google-parse-1 (&optional Message-ID)
  "Parse search result in current buffer."
  (let ((i 0)
	(case-fold-search t)
	(active (cadr (assoc nnweb-group nnweb-group-alist)))
	Subject Date Newsgroups From
	map url mid)
    (unless active
      (push (list nnweb-group (setq active (cons 1 0)))
	    nnweb-group-alist))
    ;; Go through all the article hits on this page.
    (goto-char (point-min))
    (while
	(re-search-forward
	 "a +href=\"/group/\\([^>\"]+\\)/browse_thread/[^>]+#\\([0-9a-f]+\\)"
	 nil t)
      (setq Newsgroups (match-string-no-properties 1)
	    ;; Note: Starting with Google Groups 2, `mid' is a Google-internal
	    ;; ID, not a proper Message-ID.
	    mid (match-string-no-properties 2)
	    url (format
		 (nnweb-definition 'result) Newsgroups mid))
      (narrow-to-region (search-forward ">" nil t)
			(search-forward "</a>" nil t))
      (mm-url-remove-markup)
      (mm-url-decode-entities)
      (setq Subject (buffer-string))
      (goto-char (point-max))
      (widen)
      (narrow-to-region (point)
			(search-forward "</table" nil t))

      (mm-url-remove-markup)
      (mm-url-decode-entities)
      (goto-char (point-max))
      (when
	  (re-search-backward
           "^\\(?:\\(\\w+\\) \\([0-9]+\\)\\|\\S-+\\)\\(?: \\([0-9]\\{4\\}\\)\\)? by ?\\(.*\\)"
	   nil t)
	(setq Date (if (match-string 1)
		       (format "%s %s 00:00:00 %s"
			       (match-string 1)
			       (match-string 2)
			       (or (match-string 3)
				   (format-time-string "%Y")))
		     (current-time-string)))
	(setq From (match-string 4)))
      (widen)
      (incf i)
      (unless (nnweb-get-hashtb url)
	(push
	 (list
          (incf (cdr active))
	  (make-full-mail-header
	   (cdr active) (if Newsgroups
			    (concat  "(" Newsgroups ") " Subject)
			  Subject)
	   From Date (or Message-ID mid)
	   nil 0 0 url))
	 map)
	(nnweb-set-hashtb (cadar map) (car map))))
    map))