From 0ab9e8b36cfcb3cffbc8fc51f2cfb9140378d25e Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 4 Sep 2006 17:09:44 +0000 Subject: [PATCH] references #268, occasional problems with ingest of pages with multiple references i've fixed the Amazon.com bug (i think) and made the translator show a "Could Not Save Item" prompt rather than show an empty list, but if you see any other pages where this happens, let me know --- chrome/chromeFiles/content/scholar/xpcom/translate.js | 11 +++++++++++ scrapers.sql | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/translate.js b/chrome/chromeFiles/content/scholar/xpcom/translate.js index 8c5c70cea..fa7666c31 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/translate.js +++ b/chrome/chromeFiles/content/scholar/xpcom/translate.js @@ -827,6 +827,17 @@ Scholar.Translate.prototype._enableAsynchronous = function() { * called as selectItems() in translator code */ Scholar.Translate.prototype._selectItems = function(options) { + // hack to see if there are options + var haveOptions = false; + for(var i in options) { + haveOptions = true; + break; + } + + if(!haveOptions) { + throw "translator called select items with no items"; + } + if(this._handlers.select) { return this._runHandler("select", options); } else { // no handler defined; assume they want all of them diff --git a/scrapers.sql b/scrapers.sql index 0512d709e..c058cba1b 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 72 +-- 73 -- Set the following timestamp to the most recent scraper update date REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00')); @@ -116,7 +116,7 @@ function doWeb(doc, url) { } var searchresults = Scholar.Utilities.gatherElementsOnXPath(doc, doc, xpath, nsResolver); - var items = Scholar.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/)'', ''^(Buy new|Hardcover|Paperback|Digital)$''); + var items = Scholar.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/|[^/]+/dp/)'', ''^(Buy new|Hardcover|Paperback|Digital)$''); items = Scholar.selectItems(items); if(!items) {