Skip to content

Commit

Permalink
adding more stores
Browse files Browse the repository at this point in the history
  • Loading branch information
j-manu committed May 7, 2012
1 parent 15f95bb commit fe7150d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -14,3 +14,5 @@ Then visit http://localhost:9000

WARNING: This app was built to learn Goliath. Hence some code is
non-idiomatic :)

A live version can be accessed at http://isbn.startupgang.com
1 change: 1 addition & 0 deletions app/fetcher.rb
Expand Up @@ -13,6 +13,7 @@ def self.perform(isbn, store_name)
agent = ::Mechanize.new { |agent|
agent.open_timeout = 5
agent.read_timeout = 5
agent.follow_meta_refresh = true
}
page = agent.get(url)
price = Store.parse_price(page.search(store[:pattern]).text)
Expand Down
14 changes: 13 additions & 1 deletion app/store.rb
Expand Up @@ -11,7 +11,19 @@ class Store
pattern: 'div.ourPrice'},
crossword: {
url: 'http://www.crossword.in/books/search?q=[isbn]',
pattern: '.variant-final-price'}
pattern: '.variant-final-price'},
rediff: {
url: 'http://books.rediff.com/book/ISBN:[isbn]',
pattern: 'font#book-pric b'},
indiaplaza: {
url: 'http://www.indiaplaza.com/searchproducts.aspx?sn=books&q=[isbn]',
pattern: 'div.ourPrice'},
landmark: {
url: 'http://www.landmarkonthenet.com/product/SearchPaging.aspx?code=[isbn]&type=0&num=0',
pattern: '.price .current-price'},
homeshop18: {
url: 'http://www.homeshop18.com/search:[isbn]/',
pattern: '.pdp_details_price .pdp_details_hs18Price'}
}

class << self
Expand Down

0 comments on commit fe7150d

Please sign in to comment.