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
This commit is contained in:
Simon Kornblith 2006-09-04 17:09:44 +00:00
parent 9f94de5e91
commit 0ab9e8b36c
2 changed files with 13 additions and 2 deletions

View file

@ -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

View file

@ -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) {