:dependencies [
[org.clojure/clojure "1.7.0"]
[clj-http "2.0.0"]
[clj-tagsoup "0.3.0"]]
(ns one.core
(:gen-class)
(:require [clj-http.client :as client])
(:require [clj-tagsoup :as html]))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
(ns one.core
(:gen-class))
(require '[clj-http.client :as client]
'[clojure.zip :as z]
'[clojure.data.zip :as dz]
'[clojure.data.zip.xml :as dzx]
'[crouton.html :as html])
(defn get-post-data [url]
(client/get url))
(def response (get-post-data login-URL))
(html/parse (:body response))
java.io.FileNotFoundException:
<html>
<head id="Head1"><title>
User Login Page
<\title>
<style>
body
{
color: #000000;
font: 12px\1.4 arial,FreeSans,Helvetica,sans-serif;
margin: 0;
... TONS OF HTML DELETED ...
<\center>
<\form>
<\body>
<\html>
(The filename or extension is too long)
(Unknown Source) java.io.FileInputStream.open0
FileInputStream.java:195 java.io.FileInputStream.open
FileInputStream.java:138 java.io.FileInputStream.<init>
... LOTS OF STACK TRACE DELETED ...
I've read the clojure.data.xml.zip docs carefully and looked at many examples, but I don't understand this behavior:
(require '[clj-http.client :as client] '[clojure.zip :as z] '[clojure.data.zip :as dz] '[clojure.data.zip.xml :as dzx] '[crouton.html :as html])
(def my-html "<html>\n<body>\n<input src='a.png'/>\n</body>\n</html>")
(def my-zipper (z/xml-zip (html/parse-string my-html)))
(dzx/xml1-> my-zipper)
(dzx/xml1-> my-zipper dz/descendants)
(dzx/xml1-> my-zipper :html)
(dzx/xml1-> my-zipper)
(dzx/xml1-> my-zipper dz/descendants)
(dzx/xml1-> my-zipper :html)
(dzx/xml1-> my-zipper dz/descendants)gives me what appears to be the original zipper structure, which I wasn't expecting. I was expecting a flattened-out seq of the nodes.
(dzx/xml1-> my-zipper :html)returns nil, which I really wasn't expecting. Examples on the web led me to believe that this last call should match on the html tag. Can anyone provide any explanation on these call and why I got these return values?
(ns ......
(:require [hickory.core :as h]
[hickory.select :as hs]
[cljs.core.async :as a]))
let [html (:body (a/<! (http/get url)))
parsed (-> html h/parse h/as-hickory)
inputs (hs/select
(hs/and
(hs/tag :input)
(hs/attr :href #(re-find #"sop://" %)))
parsed)]