From e6aecba5a30de54d3011be551c61ca9474da21a9 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Tue, 9 Sep 2014 11:34:58 -0400 Subject: [PATCH] Issue #67: Amazon ISBN13 search This adjusts the search to match what Amazon seems to return when searching via ISBN13 UPC. --- lib/site/amazon.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/site/amazon.class.php b/lib/site/amazon.class.php index 196efc5b..e6fe570c 100644 --- a/lib/site/amazon.class.php +++ b/lib/site/amazon.class.php @@ -61,6 +61,10 @@ function queryListing($page_no, $items_per_page, $offset, $s_item_type, $search_ $amazonasin = trim($regs[1]); } else if (preg_match("!
  • ISBN-10:\s*([0-9]+)
  • !", $pageBuffer, $regs)) { // for books, ASIN is the same as ISBN $amazonasin = trim($regs[1]); + } else if (preg_match_all("!
    ]*?name=\"([^\"])\"!", $pageBuffer, $regs)) { + if (count($regs[0]) == 1) { + $amazonasin = trim($regs[1]); + } } else if (preg_match_all("!
    Showing 1 - 12 of 55 Results
    || class="resultCount">Showing 1 Result1-24 von 194 Ergebnissen - if ((preg_match("/ id=\"resultCount\">.*?.*?.[0-9]+[\s]+?-[\s]+?[0-9]+.*?([0-9,]+).*?<\//", $pageBuffer, $regs) || preg_match("/ id=\"resultCount\">.*?.*?.([0-9]+).*?<\//", $pageBuffer, $regs))) { + if ((preg_match("/ id=\"resultCount\">.*?.*?.[0-9]+[\s]+?-[\s]+?[0-9]+.*?([0-9,]+).*?<\//", $pageBuffer, $regs) || + preg_match("/ id=\"resultCount\">.*?.*?.([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]);