Questions tagged [enlive]

Enlive is a Clojure library for HTML/XML extraction, transformation, and templating.

Enlive is a Clojure library for HTML/XML extraction and transformation.

Links:

89 questions
1
vote
0 answers

How to sparse web results elements that doesn't have their own exclusive containers using clojure enlive?

I am trying the parse an event list using Enlive. Normally, each event data is isolated in a specific div (here "result")

Event 1 title

Event 1 page

Event 1…

leontalbot
  • 2,513
  • 1
  • 23
  • 32
1
vote
1 answer

In clojure enlive how to create template to add values and keys from a map

I want to create a template with Clojure's Enlive for a "table" like html page, that should have a header and rows. I want to populate this "table" with data that comes from this map. Basicaly I want to populate header with keys, and cells with vals…
Vesna
  • 345
  • 2
  • 11
1
vote
1 answer

How to improve this Enlive template?

I use this Enlive template to transform the HTML below it to the HTML below that. Based on a collection of twitter names I generate a table with links. How can I get rid of the Hiccup inside the enlive/clone-for? (enlive/deftemplate…
Michiel Borkent
  • 34,228
  • 15
  • 86
  • 149
1
vote
2 answers

How to use unicode with enlive for web-scraping

I'm trying to scrape a few sites that require unicode support. For example, I'm trying to get the title of this book, but it returns jumbled characters: (-> "http://www.brill.nl/publications/evliya-celebis-book-travels" java.net.URL.…
pooya72
  • 1,003
  • 9
  • 15
0
votes
1 answer

How to convert Enlive Object to JSON Object in Clojure?

I'm a bit new to Clojure and wondering how to convert this Enlive Object to JSON Object. I parsed through a XML file using the parse method as below: (def xml-parser (parse…
Jett
  • 781
  • 1
  • 14
  • 30
0
votes
1 answer

What is the best way to do multiple passes over a template in enlive

I want to take an fetched html page and create an enlive template from it (-> (fetch) ; function returns clj-http.client/get (:body) (clojure.java.io/reader) (html/html-resource) ; enlive (swap-header) (swap-body-tag)) My two…
matthewdaniel
  • 1,842
  • 4
  • 21
  • 35
0
votes
2 answers

Parse HTML in Enlive like in Beautifulsoup

I am trying to get links from HTML in Clojure with Enlive. Can I get a list of all links from a page? Can I iterate over them? from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, 'html.parser') print(soup.prettify()) # # # …
nenad
  • 409
  • 3
  • 14
0
votes
3 answers

turning a html structure into a Clojure Structure

I have a html page, with one structure that I want to turn into Clojure data structure. I’m hitting a mental block on how to approach this in an idiomatic way This is the structure I have:

title1

user619882
  • 350
  • 3
  • 13

0
votes
0 answers

Conditionally Show Content or not inside deftemplate macro (Clojure - Enlive)

So far I've managed to figure out how to duplicate a div with clone-for, but I haven't found a function for conditionally applying a transformation, while inside the deftemplate macro. (deftemplate threads "thread.html" [xs] [:div.entry] ;hook to…
0
votes
1 answer

Clojure, Enlive: how to use negation when using multi-step for selector?

I'm using Enlive for Clojure. I'm trying to get span tags with class "title" within li tags, within a specific div tag.
  • wanted
  • wanted
  • gini09
    • 259
    • 3
    • 13
    0
    votes
    1 answer

    How does Enlive evaluate its rules / transformations?

    I like Enlive, but it got me somewhat confused when I observed the following. Consider the following Clojure code (also available on github): (ns enlivetest.core (:require [net.cgrand.enlive-html :refer [deftemplate defsnippet] :as…
    Oliver
    • 279
    • 2
    • 8
    0
    votes
    1 answer

    How to make identity transformation in enlive?

    I need to replace content of an element based on some condition. If condition is not met the element should be untouched. (enlive/deftemplate template (io/resource "templ.html") [] [:#el_id] (if (condition) (enlive/content ...) …
    OlegTheCat
    • 4,443
    • 16
    • 24
    0
    votes
    2 answers

    How to get the href attribute value using enlive

    I am a new to Clojure and enlive. I have html like this ....
    ..... I tried…
    gechu
    • 217
    • 3
    • 11
    0
    votes
    0 answers

    Enlive unable to parse inner span

    I am trying to extract raw data from the Apple product page, http://www.apple.com/sg/shop/browse/home/specialdeals/ipad I can get all the body content fine except the price.

    Teo Choong Ping
    • 12,512
    • 18
    • 64
    • 91
    0
    votes
    1 answer

    Enlive and —

    Trying to add an & mdash; between two divs using Enlive but {:tag :span, :attrs {:class "mdash"}, :content "—"} just returns the actual text & mdash; instead of drawing a — Thoughts?
    sova
    • 5,468
    • 10
    • 40
    • 48