Function: nnweb-google-create-mapping

nnweb-google-create-mapping is a byte-compiled function defined in nnweb.el.gz.

Signature

(nnweb-google-create-mapping)

Documentation

Perform the search and create a number-to-url alist.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnweb.el.gz
(defun nnweb-google-create-mapping ()
  "Perform the search and create a number-to-url alist."
  (with-current-buffer nnweb-buffer
    (erase-buffer)
    (nnheader-message 7 "Searching google...")
    (when (funcall (nnweb-definition 'search) nnweb-search)
	(let ((more t)
	      (i 0))
	  (while more
	    (setq nnweb-articles
		  (nconc nnweb-articles (nnweb-google-parse-1)))
	    ;; Check if there are more articles to fetch
	    (goto-char (point-min))
	    (cl-incf i 100)
	    (if (or (not (re-search-forward
			  "<a [^>]+href=\"\n?\\([^>\" \n\t]+\\)[^<]*<img[^>]+src=[^>]+next"
			  nil t))
		    (>= i nnweb-max-hits))
		(setq more nil)
	      ;; Yup, there are more articles
	      (setq more (concat (nnweb-definition 'base) (match-string 1)))
	    (when more
	      (erase-buffer)
	      (nnheader-message 7 "Searching google...(%d)" i)
	      (mm-url-insert more))))
	  ;; Return the articles in the right order.
	  (nnheader-message 7 "Searching google...done")
	  (setq nnweb-articles
		(sort nnweb-articles #'car-less-than-car))))))