commit 0ab9e8b36cfcb3cffbc8fc51f2cfb9140378d25e
parent 9f94de5e91583c723baafdd59af514a98a0b1780
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 4 Sep 2006 17:09:44 +0000
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
Diffstat:
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
@@ -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
@@ -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) {