From 321fe743283ec613ef318889705de51515f06614 Mon Sep 17 00:00:00 2001 From: ShengHuo ZHU Date: Mon, 13 Dec 1999 16:29:04 +0000 Subject: [PATCH] Follow refresh url. --- lisp/ChangeLog | 5 +++++ lisp/nnslashdot.el | 16 +++++++++------- lisp/nnweb.el | 19 ++++++++++++++++--- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 017b7d862..cfb871198 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +1999-12-13 10:59:42 Shenghuo ZHU + + * nnweb.el (nnweb-insert): Follow refresh url. + * nnslashdot.el: Use it. + 1999-12-13 10:39:53 Shenghuo ZHU * nnweb.el (nnweb-decode-entities): Decode numerical entities. diff --git a/lisp/nnslashdot.el b/lisp/nnslashdot.el index fb2090877..a864154ca 100644 --- a/lisp/nnslashdot.el +++ b/lisp/nnslashdot.el @@ -104,7 +104,7 @@ (let ((case-fold-search t)) (erase-buffer) (when (= start 1) - (nnweb-insert (format nnslashdot-article-url sid)) + (nnweb-insert (format nnslashdot-article-url sid) t) (goto-char (point-min)) (search-forward "Posted by ") (when (looking-at "]+>\\([^<]+\\)") @@ -128,7 +128,8 @@ (< start last)) (setq point (goto-char (point-max))) (nnweb-insert - (format nnslashdot-comments-url sid nnslashdot-threshold 0 start)) + (format nnslashdot-comments-url sid nnslashdot-threshold 0 start) + t) (when first-comments (setq first-comments nil) (goto-char (point-max)) @@ -203,13 +204,13 @@ (set-buffer nnslashdot-buffer) (erase-buffer) (when (= start 1) - (nnweb-insert (format nnslashdot-article-url sid)) + (nnweb-insert (format nnslashdot-article-url sid) t) (goto-char (point-min)) (search-forward "Posted by ") (when (looking-at "]+>\\([^<]+\\)") (setq from (nnweb-decode-entities-string (match-string 1)))) (search-forward " on ") - (setq date (nnslashdot-date-to-date + (setq date (nnslashdot-date-to-dat (buffer-substring (point) (1- (search-forward "<"))))) (forward-line 2) (setq lines (count-lines (point) @@ -229,7 +230,8 @@ (setq start (1+ article))) (setq point (goto-char (point-max))) (nnweb-insert - (format nnslashdot-comments-url sid nnslashdot-threshold 4 start)) + (format nnslashdot-comments-url sid nnslashdot-threshold 4 start) + t) (goto-char point) (while (re-search-forward "\\([^<]+\\).*score:\\([^)]+\\))" @@ -369,7 +371,7 @@ ;; First we do the Ultramode to get info on all the latest groups. (progn (mm-with-unibyte-buffer - (nnweb-insert "http://slashdot.org/slashdot.xml") + (nnweb-insert "http://slashdot.org/slashdot.xml" t) (goto-char (point-min)) (while (search-forward "" nil t) (narrow-to-region (point) (search-forward "")) @@ -392,7 +394,7 @@ (while (> (- nnslashdot-group-number number) 0) (mm-with-unibyte-buffer (let ((case-fold-search t)) - (nnweb-insert (format nnslashdot-active-url number)) + (nnweb-insert (format nnslashdot-active-url number) t) (goto-char (point-min)) (while (re-search-forward "article.pl\\?sid=\\([^&]+\\).*\\([^<]+\\)" nil t) diff --git a/lisp/nnweb.el b/lisp/nnweb.el index 1a6fab5fa..36047f5c3 100644 --- a/lisp/nnweb.el +++ b/lisp/nnweb.el @@ -745,10 +745,23 @@ and `altavista'.") (while (re-search-forward "<[^>]+>" nil t) (replace-match "" t t))) -(defun nnweb-insert (url) - "Insert the contents from an URL in the current buffer." +(defun nnweb-insert (url &optional follow-refresh) + "Insert the contents from an URL in the current buffer. +If FOLLOW-REFRESH is non-nil, redirect refresh url in META." (let ((name buffer-file-name)) - (url-insert-file-contents url) + (if follow-refresh + (save-restriction + (url-insert-file-contents url) + (goto-char (point-min)) + (while (re-search-forward + "HTTP-EQUIV=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" + nil t) + (let ((url (match-string 1))) + (delete-region (point-min) (point-max)) + (nnweb-insert url)) + (goto-char (point-min))) + (goto-char (point-max))) + (url-insert-file-contents url)) (setq buffer-file-name name))) (defun nnweb-parse-find (type parse &optional maxdepth) -- 2.25.1