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

Commit

Permalink
Adding homeshop18
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopch committed Jul 27, 2013
1 parent dc61278 commit 39c6f61
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
6 changes: 6 additions & 0 deletions resources/book.mustache
Expand Up @@ -72,6 +72,12 @@
<td>{{priceInfibeam}}</td> <td>{{priceInfibeam}}</td>
</tr> </tr>
{{/priceInfibeam}} {{/priceInfibeam}}
{{#priceHomeshop18}}
<tr>
<th>Homeshop18</th>
<td>{{priceHomeshop18}}</td>
</tr>
{{/priceHomeshop18}}
</table> </table>
</div> </div>
</div> </div>
Expand Down
24 changes: 22 additions & 2 deletions src/isbnnetinclj2/store.clj
Expand Up @@ -103,14 +103,34 @@
[:span.infiPrice])})) [: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 (defn book-page
[isbn] [isbn]
(let [flipkart-details (fetch-flipkart 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" (mus/render-file "book"
(reduce (reduce
merge merge
{:isbn isbn {:isbn isbn
:pageTitle (:title flipkart-details)} :pageTitle (:title flipkart-details)}
[flipkart-details [flipkart-details
infibeam-details])))) infibeam-details
homeshop18-details]))))

0 comments on commit 39c6f61

Please sign in to comment.