* Another nnweb patch
@ 1999-01-08 3:00 Rui-Tao Dong ~{6-HpLN~}
0 siblings, 0 replies; only message in thread
From: Rui-Tao Dong ~{6-HpLN~} @ 1999-01-08 3:00 UTC (permalink / raw)
I did another nnweb patch (against v5.6.45) for DejaNews. Let me know
if there is any problem.
--
Rui-Tao Dong ~{6-HpLN~} <rdong@cwixmail.com>, Mission Viejo, California
--- nnweb.el Wed Jan 6 15:50:08 1999
+++ nnweb.el-orig Sat Aug 22 01:30:41 1998
@@ -55,13 +55,13 @@
(article . nnweb-dejanews-wash-article)
(map . nnweb-dejanews-create-mapping)
(search . nnweb-dejanews-search)
- (address . "http://www.dejanews.com/dnquery.xp")
+ (address . "http://x8.dejanews.com/dnquery.xp")
(identifier . nnweb-dejanews-identity))
(dejanewsold
(article . nnweb-dejanews-wash-article)
(map . nnweb-dejanews-create-mapping)
(search . nnweb-dejanewsold-search)
- (address . "http://www.dejanews.com/dnquery.xp")
+ (address . "http://x8.dejanews.com/dnquery.xp")
(identifier . nnweb-dejanews-identity))
(reference
(article . nnweb-reference-wash-article)
@@ -354,10 +354,6 @@
(replace-match (char-to-string (or (cdr (assq (intern (match-string 1))
w3-html-entities))
?#))
- t t))
- (goto-char (point-min))
- (while (re-search-forward "&#\\([0-9]+\\);" nil t)
- (replace-match (char-to-string (string-to-number (match-string 1)))
t t)))
(defun nnweb-remove-markup ()
@@ -385,111 +381,96 @@
(case-fold-search t)
(active (or (cadr (assoc nnweb-group nnweb-group-alist))
(cons 1 0)))
- Subject Score Date Newsgroup Author
- map url beginning-of-listing end-of-listing)
+ Subject (Score "0") Date Newsgroup Author
+ map url)
(while more
;; Go through all the article hits on this page.
+ (goto-char (point-min))
(nnweb-decode-entities)
(goto-char (point-min))
- (if (re-search-forward "^<pre>$" nil t)
- (progn
- (setq beginning-of-listing (point))
- (setq end-of-listing (or
- (re-search-forward "^</pre>$" nil t)
- (point-max)))
- (goto-char beginning-of-listing)
- (while (re-search-forward
- (mapconcat 'identity
- '("^[ \t]+[0-9]+\\."
- "\\([0-9/]+\\)"
- "\\([0-9]+\\)"
- "<a href=\"\\([^\"]+\\)\">\\(.*\\)</a>"
- "<b>\\(.*\\)[ \t]*</b>"
- "<font[^>]*>\\(.*\\)[ \t]*</font>$")
- "[ \t]*") end-of-listing t)
- (setq Date (match-string 1))
- (setq Score (match-string 2))
- (setq url (concat (match-string 3) "&AH=1"))
- (setq Subject (match-string 4))
- (setq Newsgroup (match-string 5))
- (setq Author (match-string 6))
- (incf i)
- (unless (nnweb-get-hashtb url)
- (push
- (list
- (incf (cdr active))
- (make-full-mail-header
- (cdr active)
- (format "%s [%s]" Subject Newsgroup)
- Author
- Date
- (concat "<" (nnweb-identifier url) "@dejanews>")
- nil
- 0
- (string-to-int Score) url))
- map)
- (nnweb-set-hashtb (cadar map) (car map))))))
- ;; See whether there is a "Next matches" button here.
- (if (or (not (re-search-forward
- "HREF=\"\\([^\"]+\\)\"[<>b]+Next matches" nil t))
- (>= i nnweb-max-hits))
- (setq more nil)
- ;; Yup -- fetch it.
- (setq more (match-string 1))
- (erase-buffer)
- (url-insert-file-contents more)))
+ (while (re-search-forward "^ <P>\n" nil t)
+ (narrow-to-region
+ (point)
+ (cond ((re-search-forward "^ <P>\n" nil t)
+ (match-beginning 0))
+ ((search-forward "\n\n" nil t)
+ (point))
+ (t
+ (point-max))))
+ (goto-char (point-min))
+ (looking-at ".*HREF=\"\\([^\"]+\\)\"\\(.*\\)")
+ (setq url (match-string 1))
+ (let ((begin (point)))
+ (nnweb-remove-markup)
+ (goto-char begin)
+ (while (search-forward "\t" nil t)
+ (replace-match " "))
+ (goto-char begin)
+ (end-of-line)
+ (setq Subject (buffer-substring begin (point)))
+ (if (re-search-forward
+ "^ Newsgroup: \\(.*\\)\n Posted on \\([0-9/]+\\) by \\(.*\\)$" nil t)
+ (setq Newsgroup (match-string 1)
+ Date (match-string 2)
+ Author (match-string 3))))
+ (widen)
+ (incf i)
+ (unless (nnweb-get-hashtb url)
+ (push
+ (list
+ (incf (cdr active))
+ (make-full-mail-header
+ (cdr active) Subject Author Date
+ (concat "<" (nnweb-identifier url) "@dejanews>")
+ nil 0 (string-to-int Score) url))
+ map)
+ (nnweb-set-hashtb (cadar map) (car map))))
+ ;; See whether there is a "Get next 20 hits" button here.
+ (if (or (not (re-search-forward
+ "HREF=\"\\([^\"]+\\)\"[<>b]+Next result" nil t))
+ (>= i nnweb-max-hits))
+ (setq more nil)
+ ;; Yup -- fetch it.
+ (setq more (match-string 1))
+ (erase-buffer)
+ (url-insert-file-contents more)))
;; Return the articles in the right order.
(setq nnweb-articles
(sort (nconc nnweb-articles map) 'car-less-than-car))))))
(defun nnweb-dejanews-wash-article ()
- (let ((case-fold-search t)
- head-beginning head-end)
- (goto-char (point-max))
- (if (re-search-backward "^</pre>$" nil t)
- (delete-region (match-beginning 0) (point-max)))
- (if (re-search-backward "^<pre>" nil t)
- (let ((article-beginning (match-end 0)))
- (narrow-to-region article-beginning (point-max))
- (nnweb-decode-entities)
- (widen)
- (setq head-end (or (and (re-search-backward "</table>$" nil t 2)
- (re-search-backward "^<tr" nil t))
- (point-min)))
- (delete-region head-end article-beginning)
- (narrow-to-region (point-min) head-end)
- (goto-char (point-max))
- (setq head-beginning (or (re-search-backward "^<table" nil t 2)
- (point-min)))
- (delete-region (point-min) head-beginning)
- (nnweb-remove-markup)
- (nnweb-decode-entities)
- (goto-char (point-min))
- (if (re-search-forward "\\(^[ \t]*\n\\)*" nil t)
- (replace-match ""))
- (while (search-forward "\240\n" nil t)
- (replace-match ""))
- (goto-char (point-min))
- (while
- (re-search-forward "\\(\n[ \t]*\\)+\\([^:]+:\\)\n[ \t]*" nil t)
- (replace-match "\n\\2 " t))
- (goto-char (point-min))
- (if (looking-at "\n+")
- (replace-match ""))
- (widen)))))
+ (let ((case-fold-search t))
+ (goto-char (point-min))
+ (re-search-forward "<PRE>" nil t)
+ (delete-region (point-min) (point))
+ (re-search-forward "</PRE>" nil t)
+ (delete-region (point) (point-max))
+ (nnweb-remove-markup)
+ (goto-char (point-min))
+ (while (and (looking-at " *$")
+ (not (eobp)))
+ (gnus-delete-line))
+ (while (looking-at "\\(^[^ ]+:\\) *")
+ (replace-match "\\1 " t)
+ (forward-line 1))
+ (when (re-search-forward "\n\n+" nil t)
+ (replace-match "\n" t t))
+ (goto-char (point-min))
+ (when (search-forward "[More Headers]" nil t)
+ (replace-match "" t t))))
(defun nnweb-dejanews-search (search)
(nnweb-fetch-form
(nnweb-definition 'address)
`(("query" . ,search)
("defaultOp" . "AND")
- ("DBS" . "1")
- ("ST" . "PS")
- ("LNG" . "ALL")
+ ("svcclass" . "dncurrent")
("maxhits" . "100")
- ("format" . "terse")
+ ("format" . "verbose2")
+ ("threaded" . "0")
("showsort" . "date")
- ))
+ ("agesign" . "1")
+ ("ageweight" . "1")))
t)
(defun nnweb-dejanewsold-search (search)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-01-08 3:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-08 3:00 Another nnweb patch Rui-Tao Dong ~{6-HpLN~}
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).