Permalink
Browse files

Adding infibeam

  • Loading branch information...
1 parent aededcf commit dc6127849fd6b7ff77e55f753518737f25cd4191 @swaroopch committed Jul 27, 2013
Showing with 31 additions and 4 deletions.
  1. +6 −0 resources/book.mustache
  2. +25 −4 src/isbnnetinclj2/store.clj
View
@@ -66,6 +66,12 @@
<td>{{priceFlipkart}}</td>
</tr>
{{/priceFlipkart}}
+ {{#priceInfibeam}}
+ <tr>
+ <th>Infibeam</th>
+ <td>{{priceInfibeam}}</td>
+ </tr>
+ {{/priceInfibeam}}
</table>
</div>
</div>
@@ -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.