Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns rss.core
- (:gen-class)
- (:require [net.cgrand.enlive-html :as html]
- [clojure.string :as str]
- [manifold.deferred :as d]
- [byte-streams :as bs]
- [aleph.http :as http]
- [clj-rss.core :as rss]))
- (defn fetch-html
- "Fetches the website html data"
- [url]
- (html/html-resource (java.net.URL. url)))
- (def page-root
- (fetch-html "http://herald.dawn.com/in-depth"))
- (def entries (html/select page-root [html/root :.story__link]))
- (def xml (reduce str
- (map rss/channel-xml
- (map
- (fn [x]
- (let [content (:content x)
- link (:href (:attrs x))]
- {:title content
- :description "None"
- :link link}))
- entries))))
- (defn -main
- [& args]
- (print xml))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement