From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/33325 Path: main.gmane.org!not-for-mail From: dme@dme.org Newsgroups: gmane.emacs.gnus.general Subject: nnweb still in use ? Date: 12 Nov 2000 23:51:46 +0000 Sender: owner-ding@hpc.uh.edu Message-ID: <874s1cda0d.fsf@serafina-pekkala.dme.org> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035169455 24565 80.91.224.250 (21 Oct 2002 03:04:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 03:04:15 +0000 (UTC) Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by mailhost.sclp.com (Postfix) with ESMTP id 0A93FD049A for ; Sun, 12 Nov 2000 18:52:37 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id RAB25163; Sun, 12 Nov 2000 17:52:20 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 12 Nov 2000 17:51:39 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@66-209.196.61.interliant.com [209.196.61.66] (may be forged)) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id RAA08819 for ; Sun, 12 Nov 2000 17:51:27 -0600 (CST) Original-Received: from finch-post-10.mail.demon.net (finch-post-10.mail.demon.net [194.217.242.38]) by mailhost.sclp.com (Postfix) with ESMTP id C3450D049A for ; Sun, 12 Nov 2000 18:51:50 -0500 (EST) Original-Received: from serafina-pekkala.dme.org ([212.240.232.117]) by finch-post-10.mail.demon.net with esmtp (Exim 2.12 #1) id 13v6ub-000EbY-0A for ding@gnus.org; Sun, 12 Nov 2000 23:51:49 +0000 Original-To: ding@gnus.org Original-Lines: 121 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Canyonlands) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:33325 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:33325 Does anyone still use nnweb ? I'm trying to add Google support (see attached), but it seems very temperamental (and not just because of my bad HTML parsing). Index: nnweb.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/nnweb.el,v retrieving revision 6.1 diff -c -r6.1 nnweb.el *** nnweb.el 2000/11/01 01:21:46 6.1 --- nnweb.el 2000/11/12 22:52:24 *************** *** 56,62 **** (defvoo nnweb-type 'dejanews "What search engine type is being used. Valid types include `dejanews', `dejanewsold', `reference', ! and `altavista'.") (defvar nnweb-type-definition '((dejanews --- 56,62 ---- (defvoo nnweb-type 'dejanews "What search engine type is being used. Valid types include `dejanews', `dejanewsold', `reference', ! `altavista' and `google'.") (defvar nnweb-type-definition '((dejanews *************** *** 84,89 **** --- 84,95 ---- (search . nnweb-altavista-search) (address . "http://www.altavista.digital.com/cgi-bin/query") (id . "/cgi-bin/news?id@%s") + (identifier . identity)) + (google + (article . ignore) + (map . nnweb-google-create-mapping) + (search . nnweb-google-search) + (address . "http://www.google.com/search") (identifier . identity))) "Type-definition alist.") *************** *** 677,682 **** --- 683,754 ---- ("r" . "") ("d0" . "") ("d1" . ""))))) + (setq buffer-file-name nil) + t) + + ;;; + ;;; Google + ;;; + + (defun nnweb-google-create-mapping () + "Perform the search and create an number-to-url alist." + (save-excursion + (set-buffer nnweb-buffer) + (erase-buffer) + (let ((part 0)) + (when (funcall (nnweb-definition 'search) nnweb-search part) + (let ((i 0) + (more t) + (case-fold-search t) + (active (or (cadr (assoc nnweb-group nnweb-group-alist)) + (cons 1 0))) + subject date from id group + map url) + (while more + ;; Go through all the article hits on this page. + (goto-char (point-min)) + (while (re-search-forward + "^

]+\\)>\\(..*\\)" + nil t) + (setq + url (match-string 1) + subject (match-string 2) + date "Jan 1 00:00:00 0000" + group "" + id (concat "<" (match-string 1) ">") + from "unknown" + ) + (incf i) + (unless (nnweb-get-hashtb url) + (push + (list + (incf (cdr active)) + (make-full-mail-header + (cdr active) (concat "(" group ") " subject) from date + id nil 0 0 url)) + map) + (nnweb-set-hashtb (cadar map) (car map)))) + ;; See if we want more. + (when (or (not nnweb-articles) + (>= i nnweb-max-hits) + (not (funcall (nnweb-definition 'search) + nnweb-search (incf part)))) + (setq more nil))) + ;; Return the articles in the right order. + (setq nnweb-articles + (sort (nconc nnweb-articles map) 'car-less-than-car))))))) + + (defun nnweb-google-search (search &optional part) + (url-insert-file-contents + (concat + (nnweb-definition 'address) + "?" + (nnweb-encode-www-form-urlencoded + `( + ("as_qt" . "w") + ("as_q" . ,search) + ("num" . "100") + )))) (setq buffer-file-name nil) t) dme.