Function: newsticker-download-images

newsticker-download-images is a byte-compiled function defined in newst-backend.el.gz.

Signature

(newsticker-download-images FEEDNAME ITEM)

Documentation

Download the first image.

If FEEDNAME equals "imagefeed" download the first image URL found in the description=contents of ITEM to the directory temporary-file-directory(var)/temporary-file-directory(fun)/newsticker/FEEDNAME/TITLE where TITLE is the title of the item.

Source Code

;; Defined in /usr/src/emacs/lisp/net/newst-backend.el.gz
(defun newsticker-download-images (feedname item)
  "Download the first image.
If FEEDNAME equals \"imagefeed\" download the first image URL
found in the description=contents of ITEM to the directory
`temporary-file-directory'/newsticker/FEEDNAME/TITLE where TITLE
is the title of the item."
  (when (string= feedname "imagefeed")
    (let ((title (newsticker--title item))
          (desc (newsticker--desc item)))
      (when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc)
        (let ((url (substring desc (match-beginning 1) (match-end 1)))
		(temp-dir (file-name-as-directory
                           (expand-file-name
                            title (expand-file-name
                                   feedname (expand-file-name
                                             "newsticker"
                                             temporary-file-directory)))))
              (org-dir default-directory))
          (unless (file-directory-p temp-dir)
            (make-directory temp-dir t))
          (cd temp-dir)
          (message "Getting image %s" url)
          (apply #'start-process "wget-image"
                 " *newsticker-wget-download-images*"
                 newsticker-wget-name
                 (list url))
          (cd org-dir))))))