Browse files

Adding homeshop18

  • Loading branch information...
1 parent dc61278 commit 39c6f61e9dc95b0d285da8aca8cdc6f0c2c4a6b3 @swaroopch committed Jul 27, 2013
Showing with 28 additions and 2 deletions.
  1. +6 −0 resources/book.mustache
  2. +22 −2 src/isbnnetinclj2/store.clj
View
6 resources/book.mustache
@@ -72,6 +72,12 @@
<td>{{priceInfibeam}}</td>
</tr>
{{/priceInfibeam}}
+ {{#priceHomeshop18}}
+ <tr>
+ <th>Homeshop18</th>
+ <td>{{priceHomeshop18}}</td>
+ </tr>
+ {{/priceHomeshop18}}
</table>
</div>
</div>
View
24 src/isbnnetinclj2/store.clj
@@ -103,14 +103,34 @@
[:span.infiPrice])}))
+(defn homeshop18-url
+ [isbn]
+ (format
+ "http://www.homeshop18.com/%s/search:%s/categoryid:10000/"
+ isbn
+ isbn))
+
+
+(defn fetch-homeshop18
+ [isbn]
+ (log/debug (format "Fetching homeshop18 for %s" isbn))
+ (let [url (homeshop18-url isbn)
+ content (utils/fetch-page url)]
+ {:priceHomeshop18 (parse-price-from-content
+ content
+ [:span#hs18Price])}))
+
+
(defn book-page
[isbn]
(let [flipkart-details (fetch-flipkart isbn)
- infibeam-details (fetch-infibeam isbn)]
+ infibeam-details (fetch-infibeam isbn)
+ homeshop18-details (fetch-homeshop18 isbn)]
(mus/render-file "book"
(reduce
merge
{:isbn isbn
:pageTitle (:title flipkart-details)}
[flipkart-details
- infibeam-details]))))
+ infibeam-details
+ homeshop18-details]))))

0 comments on commit 39c6f61

Please sign in to comment.