help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http-get and GDS (Google Desktop Search)


From: Mathias Dahl
Subject: Re: http-get and GDS (Google Desktop Search)
Date: Wed, 08 Feb 2006 14:52:53 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

Klaus Straubinger <KSNetz@UseNet.ArcorNews.DE> writes:

> It works for me. I use it in Gnus to retrieve some RSS groups
> and of course together with Emacs/W3.

It works for me too:

;; Emacs GDS-prototype

(require 'xml)

(defvar gds-base-url nil
  "")

(setq gds-base-url "http://127.0.0.1:4664/search&s=SECURITY-TOKEN";)

(defun gds-get-xml-response (search)
  "Do a Google Desktop Search for SEARCH, return result as xml"
  (let (data xml
        gds-buffer
        (url-buffer
         (url-retrieve-synchronously 
          (format "%s?q=%s&format=xml" gds-base-url search))))
    (save-excursion
      (set-buffer url-buffer)
      (setq data (buffer-substring (point-min) (point-max)))
      ;; Create our own buffer if we need to look at the data for
      ;; debugging purposes.
      (setq gds-buffer (get-buffer-create "*gds"))
      (set-buffer gds-buffer)
      (erase-buffer)
      (insert data)
      (goto-char (point-min))
      (if (not (search-forward-regexp "^<\\?xml" nil t))
          (message "No XML data from GDS search")
        (setq xml (xml-parse-region (match-beginning 0) (point-max)))))))

;; Code ends here

Now it's just a matter of doing something useful with this, add a
couple of options etc...

/Mathias


reply via email to

[Prev in Thread] Current Thread [Next in Thread]