Skip to content

Commit

Permalink
Merge pull request #68 from utopiabound/67-amazon-isbn13
Browse files Browse the repository at this point in the history
Issue #67: Amazon ISBN13 search
  • Loading branch information
pellcorp committed Sep 9, 2014
2 parents 729d599 + e6aecba commit 866e342
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/site/amazon.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ function queryListing($page_no, $items_per_page, $offset, $s_item_type, $search_
$amazonasin = trim($regs[1]);
} else if (preg_match("!<li><b>ISBN-10:</b>\s*([0-9]+)</li>!", $pageBuffer, $regs)) { // for books, ASIN is the same as ISBN
$amazonasin = trim($regs[1]);
} else if (preg_match_all("!<div id=\"result_[0-9]+\"[^>]*?name=\"([^\"])\"!", $pageBuffer, $regs)) {
if (count($regs[0]) == 1) {
$amazonasin = trim($regs[1]);
}
} else if (preg_match_all("!<div id=\"result_([0-9]+)\"!", $pageBuffer, $regs)) {
if (count($regs[0]) == 1) {
if (preg_match("!<a href=\".*?/dp/([^/]+)/.*?keywords=.*?!", $pageBuffer, $regs)) {
Expand All @@ -82,7 +86,9 @@ function queryListing($page_no, $items_per_page, $offset, $s_item_type, $search_

//<div class="resultCount">Showing 1 - 12 of 55 Results</div> || class="resultCount">Showing 1 Result</
//<span>1-24 von 194 Ergebnissen</span>
if ((preg_match("/ id=\"resultCount\">.*?<span>.*?.[0-9]+[\s]+?-[\s]+?[0-9]+.*?([0-9,]+).*?<\//", $pageBuffer, $regs) || preg_match("/ id=\"resultCount\">.*?<span>.*?.([0-9]+).*?<\//", $pageBuffer, $regs))) {
if ((preg_match("/ id=\"resultCount\">.*?<span>.*?.[0-9]+[\s]+?-[\s]+?[0-9]+.*?([0-9,]+).*?<\//", $pageBuffer, $regs) ||
preg_match("/ id=\"resultCount\">.*?<span>.*?.([0-9]+).*?<\//", $pageBuffer, $regs) ||
preg_match("/ id=.s-result-count.*?([0-9,]+) results for/", $pageBuffer, $regs) )) {
// need to remove the commas from the total
$total = str_replace(",", "", $regs[1]);

Expand Down

0 comments on commit 866e342

Please sign in to comment.