Function: nnrss-fetch
nnrss-fetch is a byte-compiled function defined in nnrss.el.gz.
Signature
(nnrss-fetch URL &optional LOCAL)
Documentation
Fetch URL and put it in a the expected Lisp structure.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnrss.el.gz
(defun nnrss-fetch (url &optional local)
"Fetch URL and put it in a the expected Lisp structure."
(mm-with-unibyte-buffer
;;some versions of url.el need this to close the connection quickly
(let (cs xmlform htmlform)
;; bit o' work necessary for w3 pre-cvs and post-cvs
(if local
(let ((coding-system-for-read 'binary))
(insert-file-contents url))
;; FIXME: shouldn't binding `coding-system-for-read' be moved
;; to `mm-url-insert'?
(let ((coding-system-for-read 'binary))
(condition-case err
(mm-url-insert url)
(error (if (or debug-on-quit debug-on-error)
(signal (car err) (cdr err))
(message "nnrss: Failed to fetch %s" url))))))
(nnheader-remove-cr-followed-by-lf)
;; Decode text according to the encoding attribute.
(when (setq cs (nnrss-get-encoding))
(insert (prog1
(decode-coding-string (buffer-string) cs)
(erase-buffer)
(mm-enable-multibyte))))
(goto-char (point-min))
(condition-case err1
(setq xmlform (xml-parse-region (point-min) (point-max)))
(error
(condition-case err2
(setq htmlform (libxml-parse-html-region (point-min) (point-max)))
(error
(message "\
nnrss: %s: Not valid XML %s and libxml-parse-html-region doesn't work %s"
url err1 err2)))))
(if htmlform
htmlform
xmlform))))