Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
Adding infibeam
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopch committed Jul 27, 2013
1 parent aededcf commit dc61278
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
6 changes: 6 additions & 0 deletions resources/book.mustache
Expand Up @@ -66,6 +66,12 @@
<td>{{priceFlipkart}}</td>
</tr>
{{/priceFlipkart}}
{{#priceInfibeam}}
<tr>
<th>Infibeam</th>
<td>{{priceInfibeam}}</td>
</tr>
{{/priceInfibeam}}
</table>
</div>
</div>
Expand Down
29 changes: 25 additions & 4 deletions src/isbnnetinclj2/store.clj
Expand Up @@ -86,10 +86,31 @@
:binding (get flipkart-values "Binding")}))


(defn infibeam-url
[isbn]
(format
"http://www.infibeam.com/search.jsp?storeName=Books&query=%s"
isbn))


(defn fetch-infibeam
[isbn]
(log/debug (format "Fetching infibeam for %s" isbn))
(let [url (infibeam-url isbn)
content (utils/fetch-page url)]
{:priceInfibeam (parse-price-from-content
content
[:span.infiPrice])}))


(defn book-page
[isbn]
(let [flipkart-details (fetch-flipkart isbn)]
(let [flipkart-details (fetch-flipkart isbn)
infibeam-details (fetch-infibeam isbn)]
(mus/render-file "book"
(merge {:isbn isbn
:pageTitle (:title flipkart-details)}
flipkart-details))))
(reduce
merge
{:isbn isbn
:pageTitle (:title flipkart-details)}
[flipkart-details
infibeam-details]))))

0 comments on commit dc61278

Please sign in to comment.